Context
PR #293 added the mr:diff, mr:files, mr:status, and mr:logs commands. All of them require mr-iid as a positional argument. In practice, most issues have only one open MR, making the argument redundant noise.
Proposed behaviour
- Zero MRs — exit with a clear error message.
- One open MR — use it automatically (no argument needed).
- Multiple open MRs — in interactive mode, present a choice prompt (same pattern as
issue:checkout branch selection); in non-interactive mode, list the available IIDs and exit with an error asking the user to specify one.
Implementation notes
MrCommandBase::initialize() already resolves the issue NID and has access to $this->client and a GitLabClient. It can call ListMergeRequestsAction to fetch open MRs when mr-iid is not supplied.
mr-iid must stay InputArgument::OPTIONAL (Symfony disallows a required argument after an optional nid), so the runtime validation in initialize() is the right place to add the auto-selection logic.
- The interactive prompt should use
ChoiceQuestion on $mr->iid — $mr->title, consistent with the issue:checkout pattern.
Follow-up to
PR #293
Context
PR #293 added the
mr:diff,mr:files,mr:status, andmr:logscommands. All of them requiremr-iidas a positional argument. In practice, most issues have only one open MR, making the argument redundant noise.Proposed behaviour
issue:checkoutbranch selection); in non-interactive mode, list the available IIDs and exit with an error asking the user to specify one.Implementation notes
MrCommandBase::initialize()already resolves the issue NID and has access to$this->clientand aGitLabClient. It can callListMergeRequestsActionto fetch open MRs whenmr-iidis not supplied.mr-iidmust stayInputArgument::OPTIONAL(Symfony disallows a required argument after an optionalnid), so the runtime validation ininitialize()is the right place to add the auto-selection logic.ChoiceQuestionon$mr->iid — $mr->title, consistent with theissue:checkoutpattern.Follow-up to
PR #293