NO_PROMPT not working for `glab mr view`
Checklist
-
I'm using the latest version of the extension: glab 1.15 -
Operating system and version: **macOS Sonoma 14.6 ** -
Gitlab.com or self-managed instance? self-managed -
GitLab version (if self-managed): v17.1.2-ee -
I have performed glab auth status
to check for authentication issues: yes
Summary
NO_PROMPT is not honored for glab mr view
in case of many existing merge requests:
$ NO_PROMPT=1 glab mr view --output json
? Multiple merge requests exist for this branch. Select one: [Use arrows to move, type to filter]
> !188 (cascades/rebasing-v9.1-onto-main) by @mdupuy
!186 (cascades/rebasing-v9.1-onto-main) by @marge-bot
!184 (cascades/rebasing-v9.1-onto-main) by @gitlab-tagging-bot
you must select a merge request: interrupt
Environment
Standard Debian, irrelevant.
- OS: Darwin 23.6.0 arm64
- SHELL: /bin/zsh
- TERM: xterm-256color
- GLAB: Current glab version: 1.45.0 (2024-07-31)
But I reproduces in a docker Debian.
Steps to reproduce
create two MRs from 2 differents authors. Then, just NO_PROMPT=1 glab mr view
What is the current bug behavior?
It shows this prompt:
? Multiple merge requests exist for this branch. Select one: [Use arrows to move, type to filter]
> !188 (cascades/rebasing-v9.1-onto-main) by @mdupuy
!186 (cascades/rebasing-v9.1-onto-main) by @marge-bot
!184 (cascades/rebasing-v9.1-onto-main) by @gitlab-tagging-bot
What is the expected correct behavior?
No prompt shown, and I would say, last MR automatically selected. Or an error, possibly.
Relevant logs and/or screenshots
None
Proposal
When passing NO_PROMPT
, if multiple MRs would be returned we should print the list with an additional message that an ID must be passed because multiple MRs are returned.
Edited by Kai Armstrong