Change behavior of slice flags for issue edit and pr edit commands#2949
Change behavior of slice flags for issue edit and pr edit commands#2949
Conversation
26967b4 to
4ea1e37
Compare
0e300b7 to
46bf650
Compare
| "github.com/shurcooL/githubv4" | ||
| ) | ||
|
|
||
| type Editable struct { |
There was a problem hiding this comment.
The addition of add and remove was starting to make this struct excessively big which is why I decided to break it down further which resulted in much of the code changes in this PR.
mislav
left a comment
There was a problem hiding this comment.
This is great!
One final thought: unlike with other metadata fields, it actually makes sense to replace the whole set of assignees, e.g. to reassign from one user to anther. Right now, to achieve that you would need to gh pr edit --add-assignee foo --remove-assignee bar, but for that you need to spell out the name of the previous assignee. Should there be another flag, something like gh pr edit --reassign foo? This is not strictly necessary; I'm just anticipating our users' needs.
|
|
||
| if opts.Interactive && !opts.IO.CanPrompt() { | ||
| return &cmdutil.FlagError{Err: errors.New("--tile, --body, --assignee, --label, --project, or --milestone required when not running interactively")} | ||
| return &cmdutil.FlagError{Err: errors.New("field to edit flag required when not running interactively")} |
| } | ||
|
|
||
| Metadata api.RepoMetadataResult | ||
| type EditableSlice struct { |
5c31e38 to
3d0e94a
Compare
3d0e94a to
4fdf28d
Compare
|
@mislav I can see a |
This PR changes
issue editandpr editflags behavior. Previously, flags that accepted arrays of values (--label,--reviewer,--project, and--assignee) would overwrite the current values for these fields, this changes those flags to now be piecemeal changes to these fields through the definition of--addand--removevariations of those flags.For example: The
--labelflag is now split into two flags--add-labeland--remove-label.