Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions internal/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion internal/shims/shims.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand All @@ -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}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should only return a version as the 3 value if a matching one is found. Is there a reason this return value was changed?

}

for plugin, toolVersions := range existingPluginToolVersions {
Expand Down