File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package cli
33import (
44 "bytes"
55 "errors"
6+ "flag"
67 "fmt"
78 "os"
89
@@ -33,10 +34,15 @@ type readFile func(name string) ([]byte, error)
3334
3435// NewApply returns a subcommand to create bundles from directories
3536func NewApply () * cobra.Command {
36- return command .Command (& Apply {}, cobra.Command {
37+ cmd := command .Command (& Apply {}, cobra.Command {
3738 Use : "apply [flags] BUNDLE_NAME PATH..." ,
3839 Short : "Create bundles from directories, and output them or apply them on a cluster" ,
3940 })
41+
42+ fs := flag .NewFlagSet ("" , flag .ExitOnError )
43+ ctrl .RegisterFlags (fs )
44+ cmd .Flags ().AddGoFlagSet (fs )
45+ return cmd
4046}
4147
4248type Apply struct {
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package cli
22
33import (
44 "errors"
5+ "flag"
56 "fmt"
67 "math"
78 "strconv"
@@ -32,21 +33,33 @@ func NewCleanUp() *cobra.Command {
3233}
3334
3435func NewClusterRegistration () * cobra.Command {
35- return command .Command (& ClusterRegistration {}, cobra.Command {
36+ cmd := command .Command (& ClusterRegistration {}, cobra.Command {
3637 Use : "clusterregistration [flags]" ,
3738 Short : "Clean up outdated cluster registrations" ,
3839 SilenceUsage : true ,
3940 SilenceErrors : true ,
4041 })
42+
43+ fs := flag .NewFlagSet ("" , flag .ExitOnError )
44+ zopts .BindFlags (fs )
45+ ctrl .RegisterFlags (fs )
46+ cmd .Flags ().AddGoFlagSet (fs )
47+ return cmd
4148}
4249
4350func NewGitjob () * cobra.Command {
44- return command .Command (& Gitjob {}, cobra.Command {
51+ cmd := command .Command (& Gitjob {}, cobra.Command {
4552 Use : "gitjob [flags]" ,
4653 Short : "Clean up outdated git jobs" ,
4754 SilenceUsage : true ,
4855 SilenceErrors : true ,
4956 })
57+
58+ fs := flag .NewFlagSet ("" , flag .ExitOnError )
59+ zopts .BindFlags (fs )
60+ ctrl .RegisterFlags (fs )
61+ cmd .Flags ().AddGoFlagSet (fs )
62+ return cmd
5063}
5164
5265type Cleanup struct {
You can’t perform that action at this time.
0 commit comments