diff --git a/internal/cli/cli.go b/internal/cli/cli.go index 2ec0d4ca0..6ce4b3a4e 100644 --- a/internal/cli/cli.go +++ b/internal/cli/cli.go @@ -665,6 +665,9 @@ func getExecutable(logger *log.Logger, conf config.Config, command string) (exec if len(toolVersions) > 0 { if anyInstalled(conf, toolVersions) { logger.Printf("No version is set for command %s", command) + if version != "" { + logger.Printf("Requested version was %s", version) + } logger.Printf("Consider adding one of the following versions in your config file at %s/.tool-versions\n", currentDir) } else { logger.Printf("No preset version installed for command %s", command) diff --git a/internal/shims/shims.go b/internal/shims/shims.go index a7b083fcd..85b506239 100644 --- a/internal/shims/shims.go +++ b/internal/shims/shims.go @@ -69,6 +69,7 @@ func FindExecutable(conf config.Config, shimName, currentDirectory string) (path } existingPluginToolVersions := make(map[plugins.Plugin]resolve.ToolVersions) + requestedVersion := "" // loop over tools and check if the plugin for them still exists for _, shimToolVersion := range toolVersions { @@ -99,6 +100,10 @@ func FindExecutable(conf config.Config, shimName, currentDirectory string) (path } } + if len(versions.Versions) > 0 { + requestedVersion = versions.Versions[0] + } + versions.Versions = tempVersions if len(versions.Versions) > 0 { existingPluginToolVersions[plugin] = versions @@ -108,7 +113,7 @@ func FindExecutable(conf config.Config, shimName, currentDirectory string) (path } if len(existingPluginToolVersions) == 0 { - return "", plugins.Plugin{}, "", false, NoVersionSetError{shim: shimName} + return "", plugins.Plugin{}, requestedVersion, false, NoVersionSetError{shim: shimName} } for plugin, toolVersions := range existingPluginToolVersions {