diff --git a/internal/cli/cli.go b/internal/cli/cli.go index 889ece75a..1bd4ca0a4 100644 --- a/internal/cli/cli.go +++ b/internal/cli/cli.go @@ -668,6 +668,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 9853d088e..b51100eb9 100644 --- a/internal/shims/shims.go +++ b/internal/shims/shims.go @@ -69,6 +69,7 @@ func FindExecutable(conf config.Config, shimName, currentDirectory string) (stri } existingPluginToolVersions := make(map[plugins.Plugin]resolve.ToolVersions) + requestedVersion := "" // loop over tools and check if the plugin for them still exists for _, shimToolVersion := range toolVersions { @@ -93,6 +94,10 @@ func FindExecutable(conf config.Config, shimName, currentDirectory string) (stri } } + if len(versions.Versions) > 0 { + requestedVersion = versions.Versions[0] + } + versions.Versions = tempVersions if len(versions.Versions) > 0 { existingPluginToolVersions[plugin] = versions @@ -102,7 +107,7 @@ func FindExecutable(conf config.Config, shimName, currentDirectory string) (stri } if len(existingPluginToolVersions) == 0 { - return "", plugins.Plugin{}, "", false, NoVersionSetError{shim: shimName} + return "", plugins.Plugin{}, requestedVersion, false, NoVersionSetError{shim: shimName} } for plugin, toolVersions := range existingPluginToolVersions {