From 42860cca12fb69e28e960609eae0bd6b8ca532ce Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Wed, 17 Jul 2024 22:49:16 +0200 Subject: [PATCH] fix: improve formatting upgrade message (#4263) Co-authored-by: Danny Co-authored-by: Danilo Pantani --- ignite/cmd/cmd.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ignite/cmd/cmd.go b/ignite/cmd/cmd.go index 73d1b76cd9..c7cfdcdd28 100644 --- a/ignite/cmd/cmd.go +++ b/ignite/cmd/cmd.go @@ -2,7 +2,6 @@ package ignitecmd import ( "context" - "fmt" "os" "path/filepath" "slices" @@ -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() @@ -240,12 +239,12 @@ 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) @@ -253,7 +252,7 @@ func checkNewVersion(ctx context.Context) { 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) {