-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/welcome - nothing major, just icons #213
Changes from all commits
3c667d2
653737f
2cf0b76
b25cf01
8bc4e2d
bcb1531
28c616a
ee1b87d
40940ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -114,31 +114,33 @@ func (gb *GoBrew) Interactive(ask bool) { | |
fmt.Println() | ||
|
||
if currentVersion == NoneVersion { | ||
color.Warnln("GO Installed Version", ".......", currentVersion) | ||
color.Warnln("🚨 Installed Version", ".......", currentVersion, "⚠️") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we use UTF-8 characters, how will this work on remote machines? Or where a different code page is used? Didn't check? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. didn't check. UTF8 support should be there on most machines. User can always use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK |
||
} else { | ||
var labels []string | ||
if modVersion != NoneVersion && currentMajorVersion != modVersion { | ||
labels = append(labels, "not same as go.mod") | ||
labels = append(labels, "🔄 not same as go.mod") | ||
} | ||
if currentVersion != latestVersion { | ||
labels = append(labels, "not latest") | ||
labels = append(labels, "⬆️ not latest") | ||
} | ||
label := "" | ||
if len(labels) > 0 { | ||
label = "(" + strings.Join(labels, ", ") + ")" | ||
label = " " + color.FgRed.Render(label) | ||
} | ||
color.Successln("GO Installed Version", ".......", currentVersion+label) | ||
if currentVersion != latestVersion { | ||
color.Successln("✅ Installed Version", ".......", currentVersion+label, "\t🌟", latestVersion, "available") | ||
} else { | ||
color.Successln("✅ Installed Version", ".......", currentVersion+label, "\t🎉", "on latest") | ||
} | ||
} | ||
|
||
if modVersion != NoneVersion && latestMajorVersion != modVersion { | ||
label := " " + color.FgYellow.Render("(not latest)") | ||
color.Successln("GO go.mod Version", " .......", modVersion+label) | ||
label := " " + color.FgYellow.Render("\t⚠️ not latest") | ||
color.Successln("📄 go.mod Version", " .......", modVersion+label) | ||
} else { | ||
color.Successln("GO go.mod Version", " .......", modVersion) | ||
color.Successln("📄 go.mod Version", " .......", modVersion) | ||
} | ||
|
||
color.Successln("GO Latest Version", " .......", latestVersion) | ||
fmt.Println() | ||
|
||
if currentVersion == NoneVersion { | ||
|
@@ -154,10 +156,11 @@ func (gb *GoBrew) Interactive(ask bool) { | |
} | ||
|
||
if modVersion != NoneVersion && currentMajorVersion != modVersion { | ||
color.Warnf("GO Installed Version (%s) and go.mod Version (%s) are different.\n", currentMajorVersion, modVersion) | ||
color.Warnf("⚠️ GO Installed Version (%s) and go.mod Version (%s) are different.\n", currentMajorVersion, modVersion) | ||
fmt.Println(" Please consider updating your go.mod file") | ||
c := true | ||
if ask { | ||
c = askForConfirmation("Do you want to use GO version same as go.mod version (" + modVersion + "@latest)?") | ||
c = askForConfirmation("🤔 Do you want to use GO version same as go.mod version (" + modVersion + "@latest)?") | ||
} | ||
if c { | ||
gb.Use(modVersion + "@latest") | ||
|
@@ -166,10 +169,10 @@ func (gb *GoBrew) Interactive(ask bool) { | |
} | ||
|
||
if currentVersion != latestVersion { | ||
color.Warnf("GO Installed Version (%s) and GO Latest Version (%s) are different.\n", currentVersion, latestVersion) | ||
color.Warnf("⚠️ GO Installed Version (%s) and GO Latest Version (%s) are different.\n", currentVersion, latestVersion) | ||
c := true | ||
if ask { | ||
c = askForConfirmation("Do you want to update GO to latest version (" + latestVersion + ")?") | ||
c = askForConfirmation("🤔 Do you want to update GO to latest version (" + latestVersion + ")?") | ||
} | ||
if c { | ||
gb.Use(latestVersion) | ||
|
@@ -272,16 +275,16 @@ func (gb *GoBrew) ListVersions() { | |
} | ||
|
||
// ListRemoteVersions that are installed by dir ls | ||
func (gb *GoBrew) ListRemoteVersions(print bool) map[string][]string { | ||
if print { | ||
func (gb *GoBrew) ListRemoteVersions(shouldPrint bool) map[string][]string { | ||
if shouldPrint { | ||
color.Infoln("==> [Info] Fetching remote versions") | ||
} | ||
tags := gb.getGolangVersions() | ||
|
||
var versions []string | ||
versions = append(versions, tags...) | ||
|
||
return gb.getGroupedVersion(versions, print) | ||
return gb.getGroupedVersion(versions, shouldPrint) | ||
} | ||
|
||
// CurrentVersion get current version from symb link | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,6 @@ func TestJudgeVersion(t *testing.T) { | |
// }, | ||
} | ||
for _, test := range tests { | ||
test := test | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK |
||
t.Run(test.version, func(t *testing.T) { | ||
t.Parallel() | ||
ts := httptest.NewServer(http.FileServer(http.Dir("testdata"))) | ||
|
@@ -140,7 +139,6 @@ func TestExtractMajorVersion(t *testing.T) { | |
}, | ||
} | ||
for _, tt := range tests { | ||
tt := tt | ||
t.Run(tt.name, func(t *testing.T) { | ||
t.Parallel() | ||
if got := extractMajorVersion(tt.args.version); got != tt.want { | ||
|
@@ -180,7 +178,6 @@ func TestGoBrew_extract(t *testing.T) { | |
}, | ||
} | ||
for _, tt := range tests { | ||
tt := tt | ||
t.Run(tt.name, func(t *testing.T) { | ||
t.Parallel() | ||
ts := httptest.NewServer(http.FileServer(http.Dir("testdata"))) | ||
|
@@ -213,7 +210,6 @@ func Test_doRequest(t *testing.T) { | |
}, | ||
} | ||
for _, tt := range tests { | ||
tt := tt | ||
t.Run(tt.name, func(t *testing.T) { | ||
t.Parallel() | ||
ts := httptest.NewServer(http.FileServer(http.Dir("testdata"))) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK