Skip to content

feat: point unknown-flag errors at the command's help#78

Merged
andyrewlee merged 1 commit into
mainfrom
audit/31-unknown-flag-pointer
Jun 15, 2026
Merged

feat: point unknown-flag errors at the command's help#78
andyrewlee merged 1 commit into
mainfrom
audit/31-unknown-flag-pointer

Conversation

@andyrewlee

Copy link
Copy Markdown
Owner

The unknown-command path is helpful (a did-you-mean suggestion plus 'run st
help'), but an unknown flag dead-ended on the raw stdlib 'flag provided but not
defined: -nope' with no pointer -- and fat-fingering a flag is more common than
mistyping a command, for humans and agents guessing flag names. Wrap non-help
parse errors at the single choke point (parseFlagSet) with '(run "st help
" for usage)' when the set is named. %w preserves the sentinel chain, the
error code (error/exit 1), and the 'provided but not defined' text tests match.


Part of a 38-PR stacked diff (audit/01audit/38), reviewed and merged bottom-up. This PR is based on audit/30-agentmd-exitcode-guard.

@andyrewlee andyrewlee force-pushed the audit/30-agentmd-exitcode-guard branch 2 times, most recently from 7093ce9 to 1ed526f Compare June 15, 2026 06:37
The unknown-command path is helpful (a did-you-mean suggestion plus 'run st
help'), but an unknown flag dead-ended on the raw stdlib 'flag provided but not
defined: -nope' with no pointer -- and fat-fingering a flag is more common than
mistyping a command, for humans and agents guessing flag names. Wrap non-help
parse errors at the single choke point (parseFlagSet) with '(run "st help
<cmd>" for usage)' when the set is named. %w preserves the sentinel chain, the
error code (error/exit 1), and the 'provided but not defined' text tests match.
@andyrewlee andyrewlee changed the base branch from audit/30-agentmd-exitcode-guard to main June 15, 2026 06:39
@andyrewlee andyrewlee force-pushed the audit/31-unknown-flag-pointer branch from 8fb3693 to 20e2539 Compare June 15, 2026 06:39
@andyrewlee andyrewlee merged commit 5cc4b2b into main Jun 15, 2026
4 checks passed
@andyrewlee andyrewlee deleted the audit/31-unknown-flag-pointer branch June 15, 2026 06:40
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.

1 participant