diff --git a/internal/cmd/cli/apply.go b/internal/cmd/cli/apply.go index 55fddd38f8..a2ba19c382 100644 --- a/internal/cmd/cli/apply.go +++ b/internal/cmd/cli/apply.go @@ -3,6 +3,7 @@ package cli import ( "bytes" "errors" + "flag" "fmt" "os" @@ -33,10 +34,15 @@ type readFile func(name string) ([]byte, error) // NewApply returns a subcommand to create bundles from directories func NewApply() *cobra.Command { - return command.Command(&Apply{}, cobra.Command{ + cmd := command.Command(&Apply{}, cobra.Command{ Use: "apply [flags] BUNDLE_NAME PATH...", Short: "Create bundles from directories, and output them or apply them on a cluster", }) + + fs := flag.NewFlagSet("", flag.ExitOnError) + ctrl.RegisterFlags(fs) + cmd.Flags().AddGoFlagSet(fs) + return cmd } type Apply struct { diff --git a/internal/cmd/cli/cleanup.go b/internal/cmd/cli/cleanup.go index 902ac99cfd..1880111733 100644 --- a/internal/cmd/cli/cleanup.go +++ b/internal/cmd/cli/cleanup.go @@ -2,6 +2,7 @@ package cli import ( "errors" + "flag" "fmt" "math" "strconv" @@ -32,21 +33,33 @@ func NewCleanUp() *cobra.Command { } func NewClusterRegistration() *cobra.Command { - return command.Command(&ClusterRegistration{}, cobra.Command{ + cmd := command.Command(&ClusterRegistration{}, cobra.Command{ Use: "clusterregistration [flags]", Short: "Clean up outdated cluster registrations", SilenceUsage: true, SilenceErrors: true, }) + + fs := flag.NewFlagSet("", flag.ExitOnError) + zopts.BindFlags(fs) + ctrl.RegisterFlags(fs) + cmd.Flags().AddGoFlagSet(fs) + return cmd } func NewGitjob() *cobra.Command { - return command.Command(&Gitjob{}, cobra.Command{ + cmd := command.Command(&Gitjob{}, cobra.Command{ Use: "gitjob [flags]", Short: "Clean up outdated git jobs", SilenceUsage: true, SilenceErrors: true, }) + + fs := flag.NewFlagSet("", flag.ExitOnError) + zopts.BindFlags(fs) + ctrl.RegisterFlags(fs) + cmd.Flags().AddGoFlagSet(fs) + return cmd } type Cleanup struct {