NewCmdCreate returns new initialized instance of create sub command.
(f cmdutil.Factory, ioStreams genericclioptions.IOStreams)
| 59 | |
| 60 | // NewCmdCreate returns new initialized instance of create sub command. |
| 61 | func NewCmdCreate(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command { |
| 62 | o := NewCreateOptions(ioStreams) |
| 63 | |
| 64 | cmd := &cobra.Command{ |
| 65 | Use: createUsageStr, |
| 66 | DisableFlagsInUseLine: true, |
| 67 | Aliases: []string{}, |
| 68 | Short: "Create a user resource", |
| 69 | TraverseChildren: true, |
| 70 | Long: createLong, |
| 71 | Example: createExample, |
| 72 | Run: func(cmd *cobra.Command, args []string) { |
| 73 | cmdutil.CheckErr(o.Complete(f, cmd, args)) |
| 74 | cmdutil.CheckErr(o.Validate(cmd, args)) |
| 75 | cmdutil.CheckErr(o.Run(args)) |
| 76 | }, |
| 77 | SuggestFor: []string{}, |
| 78 | } |
| 79 | |
| 80 | // mark flag as deprecated |
| 81 | cmd.Flags().StringVar(&o.Nickname, "nickname", o.Nickname, "The nickname of the user.") |
| 82 | cmd.Flags().StringVar(&o.Phone, "phone", o.Phone, "The phone number of the user.") |
| 83 | |
| 84 | return cmd |
| 85 | } |
| 86 | |
| 87 | // Complete completes all the required options. |
| 88 | func (o *CreateOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error { |
no test coverage detected
searching dependent graphs…