| 91 | } |
| 92 | |
| 93 | func runEdit(config editConfig) error { |
| 94 | canPrompt := config.io.CanPrompt() |
| 95 | owner, err := config.client.NewOwner(canPrompt, config.opts.owner) |
| 96 | if err != nil { |
| 97 | return err |
| 98 | } |
| 99 | |
| 100 | project, err := config.client.NewProject(canPrompt, owner, config.opts.number, false) |
| 101 | if err != nil { |
| 102 | return err |
| 103 | } |
| 104 | config.opts.projectID = project.ID |
| 105 | |
| 106 | query, variables := editArgs(config) |
| 107 | err = config.client.Mutate("UpdateProjectV2", query, variables) |
| 108 | if err != nil { |
| 109 | return err |
| 110 | } |
| 111 | |
| 112 | if config.opts.exporter != nil { |
| 113 | return config.opts.exporter.Write(config.io, query.UpdateProjectV2.ProjectV2) |
| 114 | } |
| 115 | |
| 116 | return printResults(config, query.UpdateProjectV2.ProjectV2) |
| 117 | } |
| 118 | |
| 119 | func editArgs(config editConfig) (*updateProjectMutation, map[string]interface{}) { |
| 120 | variables := githubv4.UpdateProjectV2Input{ProjectID: githubv4.ID(config.opts.projectID)} |