MCPcopy
hub / github.com/marmotedu/iam / NewCmdCreate

Function NewCmdCreate

internal/iamctl/cmd/user/user_create.go:61–85  ·  view source on GitHub ↗

NewCmdCreate returns new initialized instance of create sub command.

(f cmdutil.Factory, ioStreams genericclioptions.IOStreams)

Source from the content-addressed store, hash-verified

59
60// NewCmdCreate returns new initialized instance of create sub command.
61func 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.
88func (o *CreateOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {

Callers 1

NewCmdUserFunction · 0.70

Calls 5

CompleteMethod · 0.95
ValidateMethod · 0.95
RunMethod · 0.95
NewCreateOptionsFunction · 0.70
FlagsMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…