(f factory.Factory)
| 49 | } |
| 50 | |
| 51 | func NewCmdCreate(f factory.Factory) *cobra.Command { |
| 52 | createFlags := NewCreateFlags() |
| 53 | |
| 54 | cmd := &cobra.Command{ |
| 55 | Use: "create", |
| 56 | Short: "Create a project", |
| 57 | Long: "Create a project in Octopus Deploy", |
| 58 | Example: heredoc.Docf(` |
| 59 | %[1]s project create |
| 60 | %[1]s project create --process-vcs |
| 61 | %[1]s project create --name 'Deploy web app' --lifecycle 'Default Lifecycle' --group 'Default Project Group' |
| 62 | `, constants.ExecutableName), |
| 63 | RunE: func(c *cobra.Command, _ []string) error { |
| 64 | opts := NewCreateOptions(createFlags, cmd.NewDependencies(f, c)) |
| 65 | |
| 66 | return createRun(opts) |
| 67 | }, |
| 68 | } |
| 69 | |
| 70 | flags := cmd.Flags() |
| 71 | flags.StringVarP(&createFlags.Name.Value, createFlags.Name.Name, "n", "", "Name of the project") |
| 72 | flags.StringVarP(&createFlags.Description.Value, createFlags.Description.Name, "d", "", "Description of the project") |
| 73 | flags.StringVarP(&createFlags.Group.Value, createFlags.Group.Name, "g", "", "Project group of the project") |
| 74 | flags.StringVarP(&createFlags.Lifecycle.Value, createFlags.Lifecycle.Name, "l", "", "Lifecycle of the project") |
| 75 | flags.BoolVar(&createFlags.ConfigAsCode.Value, createFlags.ConfigAsCode.Name, false, "Use Config As Code for the project") |
| 76 | flags.StringArrayVarP(&createFlags.Tag.Value, createFlags.Tag.Name, "t", []string{}, "Tag to apply to project, must use canonical name: <tag_set>/<tag_name>") |
| 77 | convert.RegisterCacFlags(flags, createFlags.ProjectConvertFlags) |
| 78 | flags.SortFlags = false |
| 79 | |
| 80 | return cmd |
| 81 | } |
| 82 | |
| 83 | func createRun(opts *CreateOptions) error { |
| 84 | var optsArray []cmd.Dependable |
nothing calls this directly
no test coverage detected