From 1f5e336f31328971b6d0a78cd464902ada67c193 Mon Sep 17 00:00:00 2001 From: Aravind Shankar Date: Wed, 13 Feb 2019 17:01:33 +0530 Subject: [PATCH 1/2] added a cli flag to skip update checks, close #1586 --- cli/cli.go | 3 +++ cli/commands/root.go | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cli/cli.go b/cli/cli.go index 83ffef2dc8574..b74c946e15f60 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -123,6 +123,9 @@ type ExecutionContext struct { // LastUpdateCheckFile is the file where the timestamp of last update check is stored LastUpdateCheckFile string + + // SkipUpdateCheck will skip update check + SkipUpdateCheck bool } // NewExecutionContext returns a new instance of execution context diff --git a/cli/commands/root.go b/cli/commands/root.go index 079354620745d..7792f33f20f45 100644 --- a/cli/commands/root.go +++ b/cli/commands/root.go @@ -32,7 +32,7 @@ var rootCmd = &cobra.Command{ ec.Telemetry.Command = cmd.CommandPath() if cmd.Use != updateCLICmdUse { - if update.ShouldRunCheck(ec.LastUpdateCheckFile) && ec.GlobalConfig.ShowUpdateNotification { + if update.ShouldRunCheck(ec.LastUpdateCheckFile) && ec.GlobalConfig.ShowUpdateNotification && !ec.SkipUpdateCheck { u := &updateOptions{ EC: ec, } @@ -69,6 +69,7 @@ func init() { f := rootCmd.PersistentFlags() f.StringVar(&ec.LogLevel, "log-level", "INFO", "log level (DEBUG, INFO, WARN, ERROR, FATAL)") f.StringVar(&ec.ExecutionDirectory, "project", "", "directory where commands are executed. (default: current dir)") + f.BoolVar(&ec.SkipUpdateCheck, "skip-update-check", false, "Skip update check") } // Execute executes the command and returns the error From f7a9d717e236d3f5b9514dbda7cbb79ebefca0b8 Mon Sep 17 00:00:00 2001 From: Shahidh K Muhammed Date: Thu, 14 Feb 2019 11:45:21 +0530 Subject: [PATCH 2/2] edit some strings --- cli/cli.go | 2 +- cli/commands/root.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index b74c946e15f60..faa505b62c589 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -124,7 +124,7 @@ type ExecutionContext struct { // LastUpdateCheckFile is the file where the timestamp of last update check is stored LastUpdateCheckFile string - // SkipUpdateCheck will skip update check + // SkipUpdateCheck will skip the auto update check if set to true SkipUpdateCheck bool } diff --git a/cli/commands/root.go b/cli/commands/root.go index 7792f33f20f45..3a392c387d2ef 100644 --- a/cli/commands/root.go +++ b/cli/commands/root.go @@ -68,8 +68,8 @@ func init() { rootCmd.SetHelpCommand(NewHelpCmd(ec)) f := rootCmd.PersistentFlags() f.StringVar(&ec.LogLevel, "log-level", "INFO", "log level (DEBUG, INFO, WARN, ERROR, FATAL)") - f.StringVar(&ec.ExecutionDirectory, "project", "", "directory where commands are executed. (default: current dir)") - f.BoolVar(&ec.SkipUpdateCheck, "skip-update-check", false, "Skip update check") + f.StringVar(&ec.ExecutionDirectory, "project", "", "directory where commands are executed (default: current dir)") + f.BoolVar(&ec.SkipUpdateCheck, "skip-update-check", false, "Skip automatic update check on command execution") } // Execute executes the command and returns the error