Minor Cobra cleanups

This commit is contained in:
John Gardiner Myers 2021-07-12 14:35:18 -07:00
parent 1f9f6fc8ce
commit 010aa2cf27
3 changed files with 13 additions and 17 deletions

View File

@ -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

View File

@ -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))

View File

@ -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)
},