Skip to content

Commit

Permalink
Minor Cobra cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
johngmyers committed Jul 13, 2021
1 parent 1f9f6fc commit 010aa2c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
14 changes: 6 additions & 8 deletions cmd/kops/create_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,12 @@ func NewCmdCreateCluster(f *util.Factory, out io.Writer) *cobra.Command {
encryptEtcdStorage := false

cmd := &cobra.Command{
Use: "cluster [CLUSTER]",
Short: createClusterShort,
Long: createClusterLong,
Example: createClusterExample,
Args: rootCommand.clusterNameArgsNoKubeconfig(&options.ClusterName),
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return nil, cobra.ShellCompDirectiveNoFileComp
},
Use: "cluster [CLUSTER]",
Short: createClusterShort,
Long: createClusterLong,
Example: createClusterExample,
Args: rootCommand.clusterNameArgsNoKubeconfig(&options.ClusterName),
ValidArgsFunction: cobra.NoFileCompletions,
RunE: func(cmd *cobra.Command, args []string) error {
var err error

Expand Down
2 changes: 1 addition & 1 deletion cmd/kops/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ func NewCmdRoot(f *util.Factory, out io.Writer) *cobra.Command {
cmd.AddCommand(NewCmdGet(f, out))
cmd.AddCommand(commands.NewCmdHelpers(f, out))
cmd.AddCommand(NewCmdPromote(f, out))
cmd.AddCommand(NewCmdUpdate(f, out))
cmd.AddCommand(NewCmdReplace(f, out))
cmd.AddCommand(NewCmdRollingUpdate(f, out))
cmd.AddCommand(NewCmdSet(f, out))
cmd.AddCommand(NewCmdToolbox(f, out))
cmd.AddCommand(NewCmdTrust(f, out))
cmd.AddCommand(NewCmdUnset(f, out))
cmd.AddCommand(NewCmdUpdate(f, out))
cmd.AddCommand(NewCmdUpgrade(f, out))
cmd.AddCommand(NewCmdValidate(f, out))
cmd.AddCommand(NewCmdVersion(f, out))
Expand Down
14 changes: 6 additions & 8 deletions cmd/kops/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,12 @@ func NewCmdVersion(f *util.Factory, out io.Writer) *cobra.Command {
options := &commands.VersionOptions{}

cmd := &cobra.Command{
Use: "version",
Short: versionShort,
Long: versionLong,
Example: versionExample,
Args: cobra.NoArgs,
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
return nil, cobra.ShellCompDirectiveNoFileComp
},
Use: "version",
Short: versionShort,
Long: versionLong,
Example: versionExample,
Args: cobra.NoArgs,
ValidArgsFunction: cobra.NoFileCompletions,
RunE: func(cmd *cobra.Command, args []string) error {
return commands.RunVersion(f, out, options)
},
Expand Down

0 comments on commit 010aa2c

Please sign in to comment.