| 70 | } |
| 71 | |
| 72 | func runCreate(config createConfig) error { |
| 73 | canPrompt := config.io.CanPrompt() |
| 74 | owner, err := config.client.NewOwner(canPrompt, config.opts.owner) |
| 75 | if err != nil { |
| 76 | return err |
| 77 | } |
| 78 | |
| 79 | config.opts.ownerID = owner.ID |
| 80 | query, variables := createArgs(config) |
| 81 | |
| 82 | err = config.client.Mutate("CreateProjectV2", query, variables) |
| 83 | if err != nil { |
| 84 | return err |
| 85 | } |
| 86 | |
| 87 | if config.opts.exporter != nil { |
| 88 | return config.opts.exporter.Write(config.io, query.CreateProjectV2.ProjectV2) |
| 89 | } |
| 90 | |
| 91 | return printResults(config, query.CreateProjectV2.ProjectV2) |
| 92 | } |
| 93 | |
| 94 | func createArgs(config createConfig) (*createProjectMutation, map[string]interface{}) { |
| 95 | return &createProjectMutation{}, map[string]interface{}{ |