mirror of
https://github.com/juanfont/headscale.git
synced 2024-12-27 14:45:52 -05:00
Merge pull request #156 from juanfont/disable-version-check-on-json
Disable version checker when using JSON output
This commit is contained in:
commit
809a5b84e7
@ -262,3 +262,12 @@ func JsonOutput(result interface{}, errResult error, outputFormat string) {
|
||||
}
|
||||
fmt.Println(string(j))
|
||||
}
|
||||
|
||||
func HasJsonOutputFlag() bool {
|
||||
for _, arg := range os.Args {
|
||||
if arg == "json" || arg == "json-line" {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -62,7 +62,8 @@ func main() {
|
||||
zerolog.SetGlobalLevel(zerolog.DebugLevel)
|
||||
}
|
||||
|
||||
if !viper.GetBool("disable_check_updates") {
|
||||
jsonOutput := cli.HasJsonOutputFlag()
|
||||
if !viper.GetBool("disable_check_updates") && !jsonOutput {
|
||||
if (runtime.GOOS == "linux" || runtime.GOOS == "darwin") && cli.Version != "dev" {
|
||||
githubTag := &latest.GithubTag{
|
||||
Owner: "juanfont",
|
||||
|
Loading…
Reference in New Issue
Block a user