diff --git a/cmd/add.go b/cmd/add.go index 0888115c..44029449 100644 --- a/cmd/add.go +++ b/cmd/add.go @@ -41,10 +41,10 @@ func (ac *AddCommand) Init() { ac.command = &cobra.Command{ Use: "add", Short: "Merge configuration file with $HOME/.kube/config", - Example: addExample(), RunE: func(cmd *cobra.Command, args []string) error { return ac.runAdd(cmd, args) }, + Example: addExample(), } ac.command.Flags().StringVarP(&file, "file", "f", "", "Path to merge kubeconfig files") ac.command.Flags().StringVarP(&name, "name", "n", "", "The name of contexts. if this field is null,it will be named with file name.") diff --git a/cmd/completion.go b/cmd/completion.go index 0166665d..1da1cc3b 100644 --- a/cmd/completion.go +++ b/cmd/completion.go @@ -30,10 +30,11 @@ func (cc *CompletionCommand) Init() { Use: "completion", Short: "Generates bash/zsh completion scripts", Long: `Output shell completion code for the specified shell (bash or zsh).`, - Example: completionExample(), + Aliases: []string{"c"}, RunE: func(cmd *cobra.Command, args []string) error { return cc.runCompletion(cmd, args) }, + Example: completionExample(), } } diff --git a/cmd/delete.go b/cmd/delete.go index 8c5c0d5e..3bb8960c 100644 --- a/cmd/delete.go +++ b/cmd/delete.go @@ -32,10 +32,11 @@ func (dc *DeleteCommand) Init() { Use: "delete", Short: "Delete the specified context from the kubeconfig", Long: `Delete the specified context from the kubeconfig`, - Example: deleteExample(), + Aliases: []string{"d"}, RunE: func(cmd *cobra.Command, args []string) error { return dc.runDelete(cmd, args) }, + Example: deleteExample(), } } diff --git a/cmd/merge.go b/cmd/merge.go index bfb8fc7a..e92ffd27 100644 --- a/cmd/merge.go +++ b/cmd/merge.go @@ -40,10 +40,11 @@ func (mc *MergeCommand) Init() { Use: "merge", Short: "Merge the kubeconfig files in the specified directory", Long: `Merge the kubeconfig files in the specified directory`, - Example: mergeExample(), + Aliases: []string{"m"}, RunE: func(cmd *cobra.Command, args []string) error { return mc.runMerge(cmd, args) }, + Example: mergeExample(), } mc.command.Flags().StringVarP(&folder, "folder", "f", "", "Kubeconfig folder") mc.command.Flags().BoolP("cover", "c", false, "Overwrite the original kubeconfig file") diff --git a/cmd/rename.go b/cmd/rename.go index 185a51cc..86de7273 100644 --- a/cmd/rename.go +++ b/cmd/rename.go @@ -34,10 +34,11 @@ func (rc *RenameCommand) Init() { rc.command = &cobra.Command{ Use: "rename", Short: "Rename the contexts of kubeconfig", - Long: renameExample(), + Aliases: []string{"r"}, RunE: func(cmd *cobra.Command, args []string) error { return rc.runRename(cmd, args) }, + Long: renameExample(), } rc.command.Flags().StringVarP(&oldName, "old", "o", "", "Old context name") rc.command.Flags().StringVarP(&newName, "new", "n", "", "New context name") diff --git a/cmd/switch.go b/cmd/switch.go index ab2156cd..f88b1356 100644 --- a/cmd/switch.go +++ b/cmd/switch.go @@ -42,10 +42,11 @@ func (sc *SwitchCommand) Init() { Long: ` Switch Kube Context interactively `, - Example: switchExample(), + Aliases: []string{"s"}, RunE: func(cmd *cobra.Command, args []string) error { return sc.runSwitch(cmd, args) }, + Example: switchExample(), } }