fix(upgrade): disable upgrade feedback when notice is disabled

resolves #5124
This commit is contained in:
Jan De Dobbeleer 2024-06-20 12:13:07 +02:00 committed by Jan De Dobbeleer
parent b6f5999e21
commit b809944f5c

View file

@ -4,6 +4,7 @@ import (
"fmt"
"runtime"
"github.com/jandedobbeleer/oh-my-posh/src/engine"
"github.com/jandedobbeleer/oh-my-posh/src/platform"
"github.com/jandedobbeleer/oh-my-posh/src/upgrade"
"github.com/spf13/cobra"
@ -34,8 +35,12 @@ var upgradeCmd = &cobra.Command{
return
}
cfg := engine.LoadConfig(env)
if _, hasNotice := upgrade.Notice(env, true); !hasNotice {
fmt.Print("\n✅ no new version available\n\n")
if !cfg.DisableNotice {
fmt.Print("\n✅ no new version available\n\n")
}
return
}