From 78b67fabdd38721927d98039c2dacace85849550 Mon Sep 17 00:00:00 2001 From: ShubhankarKG Date: Thu, 8 Oct 2020 21:22:26 +0530 Subject: [PATCH] 1. Added GH_NO_UPDATE_NOTIFIER to hhelp_topics 2. Updated test to check if passed variable is not empty --- cmd/gh/main.go | 2 +- pkg/cmd/root/help_topic.go | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/gh/main.go b/cmd/gh/main.go index 5fc4c2385..b4ed862fd 100644 --- a/cmd/gh/main.go +++ b/cmd/gh/main.go @@ -187,7 +187,7 @@ func printError(out io.Writer, err error, cmd *cobra.Command, debug bool) { func shouldCheckForUpdate() bool { isCIEnvironment := (os.Getenv("CI") != "") || (os.Getenv("BUILD_NUMBER") != "") || (os.Getenv("RUN_ID") != "") - isGlobalDisabled := os.Getenv("GH_NO_UPDATE_NOTIFIER") == "disabled" + isGlobalDisabled := os.Getenv("GH_NO_UPDATE_NOTIFIER") != "" return updaterEnabled != "" && !isCompletionCommand() && utils.IsTerminal(os.Stderr) && !isCIEnvironment && !isGlobalDisabled } diff --git a/pkg/cmd/root/help_topic.go b/pkg/cmd/root/help_topic.go index bd23bc68a..02218a818 100644 --- a/pkg/cmd/root/help_topic.go +++ b/pkg/cmd/root/help_topic.go @@ -39,6 +39,8 @@ func NewHelpTopic(topic string) *cobra.Command { CLICOLOR_FORCE: set to a value other than "0" to keep ANSI colors in output even when the output is piped. + + GH_NO_UPDATE_NOTIFIER: set to "1" to disable checking for updates. `) cmd := &cobra.Command{