NewCmdAlpha creates a command that acts as an alternate root command for features in alpha
(f cmdutil.Factory, streams genericiooptions.IOStreams)
| 28 | |
| 29 | // NewCmdAlpha creates a command that acts as an alternate root command for features in alpha |
| 30 | func NewCmdAlpha(f cmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command { |
| 31 | cmd := &cobra.Command{ |
| 32 | Use: "alpha", |
| 33 | Short: i18n.T("Commands for features in alpha"), |
| 34 | Long: templates.LongDesc(i18n.T("These commands correspond to alpha features that are not enabled in Kubernetes clusters by default.")), |
| 35 | } |
| 36 | |
| 37 | // NewKubeletCommand() will hide the alpha command if it has no subcommands. Overriding |
| 38 | // the help function ensures a reasonable message if someone types the hidden command anyway. |
| 39 | if !cmd.HasAvailableSubCommands() { |
| 40 | cmd.SetHelpFunc(func(*cobra.Command, []string) { |
| 41 | cmd.Println(i18n.T("No alpha commands are available in this version of kubectl")) |
| 42 | }) |
| 43 | } |
| 44 | |
| 45 | return cmd |
| 46 | } |
no test coverage detected
searching dependent graphs…