Skip to content

Allow bare invocation when a command's first alternative is optional - #21141

Open
ThePrimeagen wants to merge 3 commits into
omacom:quattrofrom
ThePrimeagen:fix/a94d4ae4-3172-4613-a4b2-59f9f3490dc6
Open

ThePrimeagen wants to merge 3 commits into
omacom:quattrofrom
ThePrimeagen:fix/a94d4ae4-3172-4613-a4b2-59f9f3490dc6

Conversation

@ThePrimeagen

Copy link
Copy Markdown
Contributor

Running omarchy boot switch with no arguments shows its usage help and exits instead of asking to switch boot loaders. The omarchy dispatcher in bin/omarchy treats the other alternatives in omarchy-boot-switch's usage as a missing required argument, so the binary's valid bare action never runs.

Screenshots

Before After
before after

Reproduce

  1. Press Super + Enter to open a terminal.
  2. On a machine still on Limine, type omarchy boot switch and press Enter.
  3. The dispatcher prints Usage: omarchy boot switch [--check] [--yes] | status | revert | install ... with Arguments, Examples and Binary help and returns to the prompt.
  4. No explanation of the switch, no This machine can move to systemd-boot. line and no Switch to systemd-boot? prompt appear, even though the examples list the bare command.

Related

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.
@greptile-apps

greptile-apps Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5RetriggerView in Greptile

[Medium impact] The PR appears safe to merge; no blocking issues were found.

Summary

The PR lets commands run without arguments when any documented alternative is entirely optional.

  • Bare commands run when one usage choice needs no arguments.

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

@chessing234

Copy link
Copy Markdown
Contributor

thanks. a bare invocation still works when the first alternative is optional, including a repeated optional group, in #21234. Please close this PR as superseded by #21234.

@omarchybot omarchybot added the bug Something isn't working label Dec 2, 2026
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>
@omarchybot omarchybot added the verified Omarchy Triage has verified that this issue is ready for final review label Dec 2, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

On an Omarchy ISO worker, bare omarchy boot switch printed usage on quattro and with the router fix reverted. The PR reached the confirmation prompt, which the test cancelled. All 147 CLI checks passed. I pushed d2168fc8 so the router guide explains when an optional alternative lets a command run without arguments.

The metadata audit found two other routes that now run bare. omarchy boot rebuild reaches its existing all-kernel rebuild path, which the worker exercised with the actual rebuild stubbed out. omarchy capture region uses its existing smart mode. GPT-6.2 Sol High in Codex, Opus 5.5 High and muse-wonder High reviewed the dispatcher. Opus 5.5 High checked the updated guide and found no remaining defects. The reviewers could have shared session context. GitHub checks passed, and the scope of the change is with the maintainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working verified Omarchy Triage has verified that this issue is ready for final review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants