MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / NewCmdCreate

Function NewCmdCreate

pkg/cmd/project/branch/create/create.go:60–84  ·  view source on GitHub ↗
(f factory.Factory)

Source from the content-addressed store, hash-verified

58}
59
60func NewCmdCreate(f factory.Factory) *cobra.Command {
61 createFlags := NewCreateFlags()
62 cmd := &cobra.Command{
63 Use: "create",
64 Short: "Create a Git branch for a project",
65 Long: "Create a Git branch for a project in Octopus Deploy",
66 Aliases: []string{"add"},
67 Example: heredoc.Docf(`
68 %[1]s project branch create
69 %[1]s project branch create --project "Deploy Website" --name branch-name --base-branch refs/heads/main
70 `, constants.ExecutableName),
71 RunE: func(c *cobra.Command, args []string) error {
72 opts := NewCreateOptions(createFlags, cmd.NewDependencies(f, c))
73
74 return CreateRun(opts)
75 },
76 }
77
78 flags := cmd.Flags()
79 flags.StringVarP(&createFlags.Project.Value, createFlags.Project.Name, "p", "", "The project")
80 flags.StringVarP(&createFlags.Name.Value, createFlags.Name.Name, "n", "", "The name of the branch")
81 flags.StringVarP(&createFlags.BaseBranch.Value, createFlags.BaseBranch.Name, "", "", "The git-ref branch to create a new branch from")
82
83 return cmd
84}
85
86func CreateRun(opts *CreateOptions) error {
87 if !opts.NoPrompt {

Callers

nothing calls this directly

Calls 3

NewCreateFlagsFunction · 0.70
NewCreateOptionsFunction · 0.70
CreateRunFunction · 0.70

Tested by

no test coverage detected