Skip to content

Commit

Permalink
fix: improve formatting upgrade message (#4263)
Browse files Browse the repository at this point in the history
Co-authored-by: Danny <[email protected]>
Co-authored-by: Danilo Pantani <[email protected]>
  • Loading branch information
3 people authored Jul 17, 2024
1 parent 1a13e8a commit 42860cc
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ignite/cmd/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package ignitecmd

import (
"context"
"fmt"
"os"
"path/filepath"
"slices"
Expand Down Expand Up @@ -73,7 +72,7 @@ To get started, create a blockchain:
// Check for new versions only when shell completion scripts are not being
// generated to avoid invalid output to stdout when a new version is available
if cmd.Use != "completion" || !strings.HasPrefix(cmd.Use, cobra.ShellCompRequestCmd) {
checkNewVersion(cmd.Context())
checkNewVersion(cmd)
}

return goenv.ConfigurePath()
Expand Down Expand Up @@ -240,20 +239,20 @@ func deprecated() []*cobra.Command {
}
}

func checkNewVersion(ctx context.Context) {
func checkNewVersion(cmd *cobra.Command) {
if gitpod.IsOnGitpod() {
return
}

ctx, cancel := context.WithTimeout(ctx, checkVersionTimeout)
ctx, cancel := context.WithTimeout(cmd.Context(), checkVersionTimeout)
defer cancel()

isAvailable, next, err := version.CheckNext(ctx)
if err != nil || !isAvailable {
return
}

fmt.Printf("⬆️ Ignite CLI %s is available! To upgrade: https://docs.ignite.com/welcome/install#upgrade", next)
cmd.Printf("⬆️ Ignite CLI %s is available! To upgrade: https://docs.ignite.com/welcome/install#upgrade (or use snap or homebrew)\n\n", next)
}

func newCache(cmd *cobra.Command) (cache.Storage, error) {
Expand Down

0 comments on commit 42860cc

Please sign in to comment.