Repository navigation
Allow bare invocation when a command's first alternative is optional - #21141
ThePrimeagen wants to merge 3 commits into
Conversation
command_requires_args stripped only [...] groups from the whole usage string, so a top-level | left bare pipes and the other alternatives behind and wrongly required an argument. Bare 'omarchy boot switch' therefore showed help instead of running the binary, whose bare action is valid. Split the usage on top-level | (ignoring pipes inside [], () and <>) and only require an argument when every alternative needs one after stripping optional groups. This also fixes the same pattern in other commands whose first alternative is all-optional.
Strip trailing ... after [...] optional groups in command_requires_args so commands like omarchy-boot-rebuild ([--initramfs PKGBASE=FILE]... [PKGBASE...] | --pacman-install | --pacman-remove) also allow bare invocation, and add CLI router tests for optional and required alternatives.
Confidence Score: 5/5
[Medium impact] The PR appears safe to merge; no blocking issues were found. SummaryThe PR lets commands run without arguments when any documented alternative is entirely optional.
No actionable issues were found in the latest change or the full-PR rule check. Related repositories’ metadata remains compatible. Reviews (2) · Last reviewed commit: "Document bare CLI argument alternatives" · Reviewed by Greptile |
Explain why a top-level optional alternative allows the router to dispatch a command with no arguments, including repeated optional groups. Co-Authored-By: GPT-6.2 Sol High <noreply@openai.com> Co-Authored-By: Opus 5.5 High <noreply@anthropic.com>
|
On an Omarchy ISO worker, bare The metadata audit found two other routes that now run bare. |
Running
omarchy boot switchwith no arguments shows its usage help and exits instead of asking to switch boot loaders. Theomarchydispatcher inbin/omarchytreats the other alternatives inomarchy-boot-switch's usage as a missing required argument, so the binary's valid bare action never runs.Screenshots
Reproduce
omarchy boot switchand press Enter.Usage: omarchy boot switch [--check] [--yes] | status | revert | install ...with Arguments, Examples and Binary help and returns to the prompt.This machine can move to systemd-boot.line and noSwitch to systemd-boot?prompt appear, even though the examples list the bare command.Related
bin/omarchyomarchy-boot-switchdirectly