Skip to content

Commit

Permalink
Hide cobra flags that are unlikely to be used
Browse files Browse the repository at this point in the history
  • Loading branch information
mortent committed Jul 30, 2020
1 parent b2afbd7 commit 90099e2
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ func GetMain() *cobra.Command {
replace(cmd)

cmd.AddCommand(versionCmd)
hideFlags(cmd)
return cmd
}

Expand Down Expand Up @@ -231,3 +232,36 @@ var versionCmd = &cobra.Command{
fmt.Printf("%s\n", version)
},
}

// hideFlags hides any cobra flags that are unlikely to be used by
// customers.
func hideFlags(cmd *cobra.Command) {
flags := []string{
// Flags related to logging
"add_dir_header",
"alsologtostderr",
"log_backtrace_at",
"log_dir",
"log_file",
"log_file_max_size",
"skip_headers",
"skip_log_headers",
"vmodule",

// Flags related to apiserver
"as",
"as-group",
"cache-dir",
"certificate-authority",
"client-certificate",
"client-key",
"insecure-skip-tls-verify",
"match-server-version",
"password",
"token",
"username",
}
for _, f := range flags {
_ = cmd.PersistentFlags().MarkHidden(f)
}
}

0 comments on commit 90099e2

Please sign in to comment.