fix(mr note): keep positional argument order in help usage

Description

fang's help renderer (styleUsage in charm.land/fang/v2) pulls every [...] group out of the usage line with the greedy regex (\[.*\]) and appends it at the end. For commands that take an optional merge request before a required ID, --help showed the arguments in the wrong order:

glab mr note update <note-id> [<id> | <branch>] [--flags]

The commands read the merge request first, so following the help fails with 404 Not Found.

This MR appends [-R <repo>] to the affected Use strings. Because the regex is greedy, the whole span from the first [ to the last ] stays together and keeps its declared order:

glab mr note update [<id> | <branch>] <note-id> [-R <repo>] [--flags]

Affected commands: mr note update, delete, resolve, reopen, draft update, draft delete. The subcommand list in glab mr note --help is fixed too.

Trade-offs:

  • [-R <repo>] now appears in these usage lines and the generated docs, unlike other commands that support -R.
  • fang dims the whole bracketed span, including the required ID.
  • Once https://github.com/charmbracelet/fang/pull/103 merges, the token can be removed.

Related to #8404

How has this been tested?

  • Built ./bin/glab and checked --help for each affected command and glab mr note --help.
  • make gen-docs, go test ./internal/commands/mr/note/..., and the lefthook pre-push hooks passed.

Screenshots

Before After
before after

🤖 Generated with Claude Code

Edited by Jay McCure

Merge request reports

Loading
Loading