From 18d7a14e3ff89694a92efd22b951f8d31afea5df Mon Sep 17 00:00:00 2001 From: Maidul Islam Date: Tue, 16 Apr 2024 13:21:05 -0400 Subject: [PATCH] add silent flag --- cli/packages/cmd/root.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cli/packages/cmd/root.go b/cli/packages/cmd/root.go index 9c7814eccd..06846260f0 100644 --- a/cli/packages/cmd/root.go +++ b/cli/packages/cmd/root.go @@ -40,8 +40,14 @@ func init() { rootCmd.PersistentFlags().StringP("log-level", "l", "info", "log level (trace, debug, info, warn, error, fatal)") rootCmd.PersistentFlags().Bool("telemetry", true, "Infisical collects non-sensitive telemetry data to enhance features and improve user experience. Participation is voluntary") rootCmd.PersistentFlags().StringVar(&config.INFISICAL_URL, "domain", util.INFISICAL_DEFAULT_API_URL, "Point the CLI to your own backend [can also set via environment variable name: INFISICAL_API_URL]") + rootCmd.PersistentFlags().Bool("silent", false, "Disable output of tip/info messages. Useful when running in scripts or CI/CD pipelines.") rootCmd.PersistentPreRun = func(cmd *cobra.Command, args []string) { - if !util.IsRunningInDocker() { + silent, err := cmd.Flags().GetBool("silent") + if err != nil { + util.HandleError(err) + } + + if !util.IsRunningInDocker() && !silent { util.CheckForUpdate() } }