Repository navigation
Validate CLI flags in clap and document every flag - #58
Merged
Merged
Conversation
Behavior change: the checks after parsing only ran on the paths that reached them; `diffr -z` opened the terminal UI, and the error surfaced only when the UI ran diffr again. As clap attributes they apply to every invocation, and the errors are clap's. - --format conflicts with --quiet and each metadata output - -z requires --name-only or --name-status - --no-index conflicts with --cached, --merge-base, -z and metadata output - --syntax requires --format, rather than being silently ignored METADATA names the five outputs one by one: pointing a conflict at the group makes clap list all five instead of the flag that was given. AI assistance: Claude Code. Agent-Session: b28d94c6-2325-41ab-9fab-e9027acc5b09 Agent-Session: 01a0e9c2-2c41-7062-b484-92e030c4ab9c
Behavior change: clap rejects 0 with "number would be zero for non-zero type", in place of the check that ran only after the diff session opened. AI assistance: Claude Code. Agent-Session: b28d94c6-2325-41ab-9fab-e9027acc5b09 Agent-Session: 01a0e9c2-2c41-7062-b484-92e030c4ab9c
Behavior change: `--syntax --stat` and `--stream-annotations --quiet` are rejected. clap waives `requires` when the required argument conflicts with one that was given, so --format conflicting with --stat excused --syntax's missing --format. AI assistance: Claude Code. Agent-Session: b28d94c6-2325-41ab-9fab-e9027acc5b09 Agent-Session: 01a0e9c2-2c41-7062-b484-92e030c4ab9c
AI assistance: Claude Code. Agent-Session: b28d94c6-2325-41ab-9fab-e9027acc5b09 Agent-Session: 01a0e9c2-2c41-7062-b484-92e030c4ab9c
Behavior change, errors only: a malformed GLOB:LANG_NAME in --override or DFT_OVERRIDE is a clap error naming the value and the reason, in place of parse_overrides_or_die's own messages and process::exit. DFT_OVERRIDE_1..9, read outside clap, share the parser and report in clap's format with the variable's name; a non-UTF-8 value is an error rather than silently skipped. Adjacent overrides naming one language still merge. AI assistance: Claude Code. Agent-Session: b28d94c6-2325-41ab-9fab-e9027acc5b09 Agent-Session: 01a0e9c2-2c41-7062-b484-92e030c4ab9c
Behavior change: the four actions move into a flattened DebugAction struct marked `#[group(required = true, multiple = false)]`. `diffr debug` with no action is clap's "required arguments were not provided", and two actions are rejected; they used to run whichever came first in a fixed order. AI assistance: Claude Code. Agent-Session: b28d94c6-2325-41ab-9fab-e9027acc5b09 Agent-Session: 01a0e9c2-2c41-7062-b484-92e030c4ab9c
Behavior change, help text only. Every top-level flag without help gets a doc comment, and the debug options' help strings become doc comments too: clap drops their trailing periods in -h, and --override's first line is now a summary, with its examples under --help. AI assistance: Claude Code. Agent-Session: b28d94c6-2325-41ab-9fab-e9027acc5b09 Agent-Session: 01a0e9c2-2c41-7062-b484-92e030c4ab9c
AI assistance: Claude Code. Agent-Session: b28d94c6-2325-41ab-9fab-e9027acc5b09 Agent-Session: 01a0e9c2-2c41-7062-b484-92e030c4ab9c
sidkmenon
added this pull request to stack #59
September 30, 2026 16:28
sidkmenon
marked this pull request as ready for review
September 30, 2026 17:11
Merged
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.
Stack created with GitHub Stacks CLI • Give Feedback 💬