Skip to content
Snippets Groups Projects
Commit 9d40f32e authored by kaiyou's avatar kaiyou
Browse files

Hide unwanted k8s global flags more properly

parent 84b47e5d
No related branches found
No related tags found
No related merge requests found
Pipeline #23864 passed
...@@ -29,7 +29,8 @@ type Config struct { ...@@ -29,7 +29,8 @@ type Config struct {
var config Config var config Config
func (c *Config) Complete() error { func (c *Config) Complete() error {
// Print version if requested // Print version if requested, verflag flags are declared
// by init() functions deep in k8s code
verflag.PrintAndExitIfRequested() verflag.PrintAndExitIfRequested()
// Mount a shell if required // Mount a shell if required
if c.Shell != "" { if c.Shell != "" {
...@@ -70,10 +71,8 @@ func (c *Config) Complete() error { ...@@ -70,10 +71,8 @@ func (c *Config) Complete() error {
} }
func init() { func init() {
verflag.AddFlags(Hepto.Flags()) // Expose k8s version directly // Hide unwanted flags declared inside k8s init() directly
// Force-reinit pflag global cli object, because k8s has a nasty habit of pflag.CommandLine.MarkHidden("azure-container-registry-config")
// globally registering flags in init()
pflag.CommandLine = pflag.NewFlagSet("hepto", pflag.ExitOnError)
cobra.OnInitialize(viper.AutomaticEnv) cobra.OnInitialize(viper.AutomaticEnv)
// General config // General config
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment