Skip to content

Commit

Permalink
fix(upgrade): stop spinner correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
JanDeDobbeleer committed Jul 6, 2024
1 parent e9119d4 commit 4c3110f
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/cli/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ var upgradeCmd = &cobra.Command{

latest, err := upgrade.Latest(env)
if err != nil {
fmt.Printf("\n❌ %s\n\n", err)
terminal.StopProgress()
fmt.Printf("\n❌ %s\n\n%s", err, terminal.StopProgress())
os.Exit(1)
return
}
Expand All @@ -58,27 +57,29 @@ var upgradeCmd = &cobra.Command{

version := fmt.Sprintf("v%s", build.Version)

if version == latest {
if !cfg.DisableNotice {
fmt.Print("\n✅ no new version available\n\n")
}

terminal.StopProgress()
if version != latest {
executeUpgrade(latest)
return
}

executeUpgrade(latest)
message := terminal.StopProgress()

if !cfg.DisableNotice {
message += "\n✅ no new version available\n\n"
}

fmt.Print(message)
},
}

func executeUpgrade(latest string) {
err := upgrade.Run(latest)
fmt.Print(terminal.StopProgress())
if err == nil {
return
}

fmt.Printf("\n❌ %s\n\n", err)
terminal.StopProgress()
os.Exit(1)
}

Expand Down

0 comments on commit 4c3110f

Please sign in to comment.