mirror of https://github.com/k3s-io/k3s
kubeadm: add GetSupportedShells() to completion.go
Add the function GetSupportedShells() in completion.go and export it. It will be re-used in tests to obtain the valid list of supported shells.pull/8/head
parent
23a9136d4e
commit
8303f8ecc8
|
@ -89,13 +89,17 @@ var (
|
|||
}
|
||||
)
|
||||
|
||||
// NewCmdCompletion return command for executing "kubeadm completion" command
|
||||
func NewCmdCompletion(out io.Writer, boilerPlate string) *cobra.Command {
|
||||
// GetSupportedShells returns a list of supported shells
|
||||
func GetSupportedShells() []string {
|
||||
shells := []string{}
|
||||
for s := range completionShells {
|
||||
shells = append(shells, s)
|
||||
}
|
||||
return shells
|
||||
}
|
||||
|
||||
// NewCmdCompletion returns the "kubeadm completion" command
|
||||
func NewCmdCompletion(out io.Writer, boilerPlate string) *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "completion SHELL",
|
||||
Short: i18n.T("Output shell completion code for the specified shell (bash or zsh)."),
|
||||
|
@ -105,7 +109,7 @@ func NewCmdCompletion(out io.Writer, boilerPlate string) *cobra.Command {
|
|||
err := RunCompletion(out, boilerPlate, cmd, args)
|
||||
kubeadmutil.CheckErr(err)
|
||||
},
|
||||
ValidArgs: shells,
|
||||
ValidArgs: GetSupportedShells(),
|
||||
}
|
||||
|
||||
return cmd
|
||||
|
|
Loading…
Reference in New Issue