Skip to content

Commit

Permalink
Merge pull request #47 from DopplerHQ/tom_plain
Browse files Browse the repository at this point in the history
Don't print version update message if plain flag is specified
  • Loading branch information
Piccirello authored Dec 12, 2019
2 parents 210bb79 + 5bb92f8 commit 83b795c
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions pkg/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,21 @@ var rootCmd = &cobra.Command{
fmt.Println("")
}

// disable version checking on the "run" command
if version.PerformVersionCheck && cmd.CalledAs() != "run" {
silent := utils.GetBoolFlagIfChanged(cmd, "silent", false)
plain := utils.GetBoolFlagIfChanged(cmd, "plain", false)
canPrintResults := utils.Debug || (!silent && !plain && !utils.OutputJSON)

versionCheck := http.CheckCLIVersion(configuration.VersionCheck(), silent, utils.OutputJSON, utils.Debug)
if versionCheck != (models.VersionCheck{}) {
shouldPrint := utils.Debug || (!silent && !utils.OutputJSON)
if version.ProgramVersion != versionCheck.LatestVersion && shouldPrint {
fmt.Printf("Doppler CLI version %s is now available\n", versionCheck.LatestVersion)
// disable version checking on the "run" command
if version.PerformVersionCheck && canPrintResults && cmd.CalledAs() != "run" {
versionCheck := http.CheckCLIVersion(configuration.VersionCheck(), silent, utils.OutputJSON, utils.Debug)
if versionCheck != (models.VersionCheck{}) {
if version.ProgramVersion != versionCheck.LatestVersion {
fmt.Printf("Doppler CLI version %s is now available\n", versionCheck.LatestVersion)
}

configuration.SetVersionCheck(versionCheck)
}

configuration.SetVersionCheck(versionCheck)
}
}
},
Run: func(cmd *cobra.Command, args []string) {
cmd.Usage()
Expand Down

0 comments on commit 83b795c

Please sign in to comment.