docs: fix three stale CLI flags in the how-to examples (--line-number, --tokens, --exclude-from-tree) - #335
Merged
ODAncona merged 3 commits intoSep 5, 2026
Conversation
clap derives the long name from the field, so `line_numbers` in crates/code2prompt/src/args.rs is exposed as `-l` / `--line-numbers`. The documented `--line-number` is rejected with "error: unexpected argument '--line-number' found". Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`--tokens` no longer exists; the CLI now always prints the token count and `--token-format <raw,format>` selects how it is rendered (crates/code2prompt/src/args.rs, crates/code2prompt/src/main.rs). The tokenizer example only needs `--encoding`, so the dead flag is simply dropped there. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
That flag no longer exists. Pruning non-matching entries from the source tree is now the default: crates/code2prompt-core/src/path.rs computes `let include_in_tree = config.full_directory_tree || entry_match;`, so `--full-directory-tree` is the opt-out. The surrounding sentence stays accurate, only the dead flag is removed; the English page gains one line pointing at `--full-directory-tree`. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Problem
Three flags used in the "how to" examples no longer exist in the CLI, so every one of those commands fails outright — clap rejects unknown arguments:
crates/code2prompt/src/args.rs)--line-numberpub line_numbers: bool→-l/--line-numbers--tokens--token-format <raw,format>selects the rendering--exclude-from-tree--full-directory-treeis the opt-outReproduced against
main(6f7a7ff), aftercargo build -p code2prompt:There is no clap alias or
infer_long_argskeeping the old spellings alive (grep -rnE 'clap\(.*alias|visible_alias|infer_long_args' crates/→ no output), and--exclude-from-treeappears nowhere incrates/any more.--helpconfirms the real names:Change
Three independent commits, one per flag, so a smaller subset can be taken if preferred:
--line-number→--line-numbers(pure rename).--tokens→--token-format=format; the tokenizer example only needs--encoding=p50k, so the dead flag is just dropped there. The count itself is printed unconditionally now (crates/code2prompt/src/main.rs,format_number(token_count, &session.config.token_format)).--exclude-from-treeremoved from the exclude example. The surrounding sentence ("Exclude files/folders from the source tree based on exclude patterns") stays accurate, because that pruning is now the default:Only the English page gains one extra line pointing at
--full-directory-treeas the opt-out — I deliberately did not machine-translate that sentence into the six localized copies, so their diff stays a pure token deletion.14 files:
README_ES.md,website/src/content/docs/docs/how_to/cli.mdx, and thede/es/fr/ja/ru/zhcopies ofcli.mdxandfilter_files.md.README.mdand the Englishfilter_files.mdare untouched (the former does not contain these flags, the latter does not exist).Verification
Tree semantics, on a scratch dir containing
keep.txt,drop.wav,sub/also.wav:Every command as it now reads in the docs exits 0:
Post-change greps are empty:
The docs site still builds, and the rendered page picks up the new note:
Limitations
cargo testbehaviour is unchanged; I did not run the full test suite.--output-file#309 (--output-filetypo in the quickstart) and Fix the broken star history chart in the README #333.🤖 Generated with Claude Code