Skip to content

Exit 1 when a command that needs an argument is run without one - #18797

Merged
dhh merged 3 commits into
omacom:quattrofrom
ThePrimeagen:fix/c15a4b71-d1f4-426a-bb73-eba0cae71e64
Nov 15, 2026
Merged

dhh merged 3 commits into
omacom:quattrofrom
ThePrimeagen:fix/c15a4b71-d1f4-426a-bb73-eba0cae71e64

Conversation

@ThePrimeagen

Copy link
Copy Markdown
Contributor

Running a command that needs an argument without one, such as omarchy tailscale send, prints its usage and exits 0, so a script reads it as success when nothing was sent. The dispatcher in bin/omarchy shows the command's help in place of running it and returns 0, though the command itself exits 1.

Screenshots

Before After
before after

Reproduce

  1. Press Super + Enter to open a terminal.
  2. Type omarchy tailscale send; echo EXIT:$? and press Enter.
  3. The usage for omarchy tailscale send <machine> [file...] prints, followed by EXIT:0.

More cases

omarchy font set with no font name

Before After
before after

Related

The dispatcher intercepted a bare invocation of a command that
declares required arguments, printed its help, and returned 0,
reporting success for a command that never ran, unlike the binary
itself which exits 1. Return 1 for that command-help case in both
dispatch_fast_or_help and dispatch_or_help, while a bare group
name still shows group help and returns 0.
@greptile-apps

greptile-apps Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Summary

The PR makes bare commands with missing required arguments show help and exit 1. Bare group help and explicit help still exit 0.

  • Bare commands that need arguments now exit with status 1.

Reviews (3) · Last reviewed commit: "Document that a bare required-argument c..." · Reviewed by Greptile

Comment thread bin/omarchy Resolved
ThePrimeagen and others added 2 commits November 13, 2026 15:29
The CLI suite still expected bare `omarchy share` and `omarchy menu share` to succeed, so under set -e the new exit status stopped it before the help checks. Capture the status of both and assert it is 1, keeping the usage text checks.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@omarchybot

Copy link
Copy Markdown
Collaborator

Pushed 6493ae6, which updates docs/cli-router.md. Its paragraph on the router's own exit codes listed only 127. It now also says that a bare command missing its required arguments shows its help and exits 1, and that bare group help and an explicit --help exit 0.

Tests, against Omarchy's rules on when a test is warranted: both test/cli additions kept. Each extends an existing invocation with a three-line status check, and each guards one of the two hunks. On a worker, reverting only the dispatch_or_help return failed the omarchy share check, and reverting only the dispatch_fast_or_help return failed the omarchy menu share check. Nothing was cut.

Proved on a worker built from the Omarchy ISO: ./test/cli passes. Exit codes there:

  • omarchy share, omarchy menu share, omarchy theme set and omarchy tailscale send: 1
  • omarchy share --help and omarchy menu: 0

Second opinion: Codex Medium. It found no defects, checked each claim in the docs line against bin/omarchy, and agreed both tests stay (its independence from this review isn't guaranteed).

@dhh
dhh merged commit 84c4c55 into omacom:quattro Nov 15, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants