Skip to content

Commit

Permalink
Merge pull request #7 from MTVersionManager/caseinsensitive
Browse files Browse the repository at this point in the history
Make string comparisons case-insensitive
  • Loading branch information
leomick authored Nov 25, 2024
2 parents 0eac1f0 + 50e7885 commit 3ef7e29
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion cmd/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/spf13/cobra"
"log"
"os"
"strings"
)

type installModel struct {
Expand Down Expand Up @@ -54,7 +55,7 @@ If you run "mtvm install go latest" it will install the latest version of go`,
log.Fatal(err)
}
version := args[1]
if version == "latest" {
if strings.ToLower(version) == "latest" {
var err error
version, err = plugin.GetLatestVersion()
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion cmd/use.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"log"
"os"
"path/filepath"
"strings"

"github.com/spf13/cobra"
)
Expand All @@ -32,7 +33,7 @@ So if you run go version it will print the version number 1.23.3`,
switch {
case len(args) == 2:
version := args[1]
if version == "latest" {
if strings.ToLower(version) == "latest" {
var err error
version, err = plugin.GetLatestVersion()
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion shared/shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"github.com/MTVersionManager/mtvmplugin"
"os"
"path/filepath"
"strings"

"github.com/MTVersionManager/mtvm/config"
)
Expand All @@ -25,7 +26,7 @@ func IsVersionInstalled(tool string, version string) (bool, error) {

func LoadPlugin(tool string) (mtvmplugin.Plugin, error) {
var plugin mtvmplugin.Plugin
if tool == "go" {
if strings.ToLower(tool) == "go" {
plugin = &goplugin.Plugin{}
} else {
return nil, errors.New("plugin support is not yet implemented")
Expand Down

0 comments on commit 3ef7e29

Please sign in to comment.