fix(cli): show help for bare exec command - #1361
Merged
Merged
Conversation
Merged
jdx
added a commit
that referenced
this pull request
Sep 2, 2026
Rebasing brought in #1361, which answers `usage exec -h` with the command's own page instead of an error about the missing positionals. Two things follow: - The help said `-h` and `--help` print the script's page "rather than this one", which is now only true once a script is named. It says both halves. - The test that shipped with #1361 asserts the command's first help line, and this branch rewrote it. It now matches on a fragment rather than the whole sentence, because the renderer wraps the page to the terminal width and the full line arrives with a newline in it. Generated artifacts are regenerated against the rebased tree, which also picks up the 6.6.1 version bump. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
Instruction counts
No instruction-count regression above 1%. Only instruction counts gate. Wall clock is shown for context — on identical hardware it moves 4-20% run to run. Measured by tak — instruction-counted CLI benchmarks, stored in this repository's git notes. Shadow comparisonParsing
|
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1360.
execintentionally owns-hand--helpso a fully specified invocation can render the wrapped script's usage spec. Handle the bare command before required positional validation sousage exec --helpprints theexeccommand page instead of reporting a missing<COMMAND>.This preserves wrapped-script help for
usage exec <COMMAND> <BIN> --helpand supports thexalias plus both help spellings.Tests:
cargo test -p usage-cli --all-featurescargo clippy -p usage-cli --all-features --all-targets -- -D warningsThis PR was generated by Codex.
Note
Low Risk
Small pre-parse branch in the CLI entrypoint; behavior change is limited to bare exec help and is covered by new tests.
Overview
usage exec -h/usage exec --help(and thexalias) now print theexecsubcommand help instead of failing on missing<COMMAND>/<BIN>.Cli::runintercepts that two-argument pattern before normal parsing and renders theexecpage viausage_rs::help::render_styled, matching whatusage help execalready shows. Invocations with a command and binary still route-h/--helpto the wrapped script’s usage, unchanged.Integration test
test_exec_help_without_a_scriptcoversexec/x×-h/--helpand expects success with empty stderr.Reviewed by Cursor Bugbot for commit be4fdc1. Bugbot is set up for automated code reviews on this repo. Configure here.