Skip to content

Commit

Permalink
feat: welcome messages has icons
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincobain2000 committed Nov 11, 2024
1 parent 007a5f6 commit 3c667d2
Showing 1 changed file with 23 additions and 17 deletions.
40 changes: 23 additions & 17 deletions gobrew.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,31 +114,36 @@ func (gb *GoBrew) Interactive(ask bool) {
fmt.Println()

if currentVersion == NoneVersion {
color.Warnln("GO Installed Version", ".......", currentVersion)
color.Warnln("🚨 Installed Version", ".......", currentVersion, "⚠️")
} 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 = "(" + 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)
// color.Successln("🌟 GO Latest Version", " .......", latestVersion)

fmt.Println()

if currentVersion == NoneVersion {
Expand All @@ -154,14 +159,15 @@ 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)
c := true
if ask {
c = askForConfirmation("Do you want to use GO version same as go.mod version (" + modVersion + "@latest)?")
}
if c {
gb.Use(modVersion + "@latest")
}
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)?")
// }
// if c {
// gb.Use(modVersion + "@latest")
// }
return
}

Expand Down

0 comments on commit 3c667d2

Please sign in to comment.