| 51 | } |
| 52 | |
| 53 | func (co *CreateOptions) Commit() error { |
| 54 | lifecycle, err := co.Client.Lifecycles.GetByIDOrName(co.Lifecycle.Value) |
| 55 | if err != nil { |
| 56 | return err |
| 57 | } |
| 58 | |
| 59 | projectGroup, err := co.Client.ProjectGroups.GetByIDOrName(co.Group.Value) |
| 60 | if err != nil { |
| 61 | return err |
| 62 | } |
| 63 | |
| 64 | project := projects.NewProject(co.Name.Value, lifecycle.GetID(), projectGroup.GetID()) |
| 65 | project.Description = co.Description.Value |
| 66 | project.ProjectTags = co.Tag.Value |
| 67 | |
| 68 | createdProject, err := co.Client.Projects.Add(project) |
| 69 | if err != nil { |
| 70 | return err |
| 71 | } |
| 72 | |
| 73 | _, err = fmt.Fprintf(co.Out, "\nSuccessfully created project '%s' (%s), with lifecycle '%s' in project group '%s'.\n", createdProject.Name, createdProject.Slug, co.Lifecycle.Value, co.Group.Value) |
| 74 | if err != nil { |
| 75 | return err |
| 76 | } |
| 77 | |
| 78 | link := output.Bluef("%s/app#/%s/projects/%s", co.Host, co.Space.GetID(), createdProject.GetID()) |
| 79 | fmt.Fprintf(co.Out, "View this project on Octopus Deploy: %s\n", link) |
| 80 | |
| 81 | return nil |
| 82 | } |
| 83 | |
| 84 | func (co *CreateOptions) GenerateAutomationCmd() { |
| 85 | if !co.NoPrompt { |