Skip to content

Commit

Permalink
add short Aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
sunny0826 committed Jan 17, 2020
1 parent 1fce32d commit 6db358a
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmd/add.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
3 changes: 2 additions & 1 deletion cmd/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
}

Expand Down
3 changes: 2 additions & 1 deletion cmd/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}

}
Expand Down
3 changes: 2 additions & 1 deletion cmd/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 2 additions & 1 deletion cmd/rename.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
3 changes: 2 additions & 1 deletion cmd/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
}

Expand Down

0 comments on commit 6db358a

Please sign in to comment.