Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions bin/omarchy
Original file line number Diff line number Diff line change
Expand Up @@ -1063,10 +1063,11 @@ dispatch_fast_or_help() {
if (( DIRECT_RESOLVED_COUNT == 1 )) && group_has_child_commands "$1"; then
load_group_commands "$1"
show_group_help "$1"
return 0
else
show_command_help "$key"
return 1
fi
return 0
fi
fi

Expand Down Expand Up @@ -1127,10 +1128,11 @@ dispatch_or_help() {
if (( ${#remaining[@]} == 0 )) && command_requires_args "$key"; then
if (( RESOLVED_COUNT == 1 )) && group_exists "$1"; then
show_group_help "$1"
return 0
else
show_command_help "$key"
return 1
Comment thread
greptile-apps[bot] marked this conversation as resolved.
Resolved
fi
return 0
fi

exec "$binary_path" "${remaining[@]}"
Expand Down
4 changes: 1 addition & 3 deletions docs/cli-router.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ none were given, the router shows help instead of executing — `omarchy theme
set` prints usage rather than running an interactive setter. A bare group name
with child commands shows the group help.

Dispatch is `exec`: the router process is replaced, the binary sees only the
leftover arguments, and the exit code is the binary's own. The router itself
exits 127 for unknown routes or missing binaries.
Dispatch is `exec`: the router process is replaced, the binary sees only the leftover arguments, and the exit code is the binary's own. The router itself exits 127 for unknown routes or missing binaries, and 1 for a bare command missing its required arguments, after showing its help. A bare group showing its help, and an explicit `--help`, exit 0.

When nothing resolves, the router tries a prefix listing — `omarchy hw asus`
prints every command whose usage starts with that prefix — and otherwise
Expand Down
10 changes: 8 additions & 2 deletions test/cli
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,17 @@ assert_output_contains "the flags-only command keeps its own help" "$output" "om
output=$("$CLI" menu --help)
assert_output_contains "menu group includes share fallback route" "$output" "omarchy menu share"

output=$("$CLI" share)
status=0
output=$("$CLI" share) || status=$?
(( status == 1 )) || fail "bare required-arg alias exits 1"
pass "bare required-arg alias exits 1"
assert_output_contains "bare required-arg alias renders CLI help" "$output" "Usage:"
assert_output_contains "bare share help uses canonical route" "$output" "omarchy share <clipboard|file|folder> [path...]"

output=$("$CLI" menu share)
status=0
output=$("$CLI" menu share) || status=$?
(( status == 1 )) || fail "bare required-arg filename route exits 1"
pass "bare required-arg filename route exits 1"
assert_output_contains "bare required-arg filename route renders CLI help" "$output" "omarchy share <clipboard|file|folder> [path...]"

CLI="$CLI" python3 <<'PY'
Expand Down
Loading