feat: add rtk wc command for compact word/line/byte counts#175
Merged
pszymkowiak merged 1 commit intortk-ai:masterfrom Feb 18, 2026
Merged
feat: add rtk wc command for compact word/line/byte counts#175pszymkowiak merged 1 commit intortk-ai:masterfrom
rtk wc command for compact word/line/byte counts#175pszymkowiak merged 1 commit intortk-ai:masterfrom
Conversation
Adds a new `wc` subcommand that compresses wc output by: - Stripping alignment padding: ` 30 96 978 file.py` → `30L 96W 978B` - Removing common path prefixes in multi-file output - Returning bare numbers for single-flag modes (-l, -w, -c, -m) - Showing Σ totals instead of verbose "total" lines Includes 15 unit tests covering single/multi-file, stdin, all flag modes, and common prefix detection. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
CI note: Documentation Validation failure is pre-existingThe
This is not caused by this PR — the same check fails on The issue is that |
Collaborator
Minor nit (non-blocking): Clippy suggests replacing parts.last().map_or(false, ...) with parts.last().is_some_and(...) in two places (lines 205 and 239). Feel free to fix or leave as-is. |
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.
Summary
rtk wcsubcommand that compresseswcoutput (strips padding, shortens paths, returns bare numbers for single-flag modes)30 96 978 file.py→30L 96W 978BΣ-l,-w,-c,-m): returns bare numberChanges
src/wc_cmd.rssrc/main.rsmod wc_cmd,Wcenum variant, dispatch handlerNo hooks, docs, or init template changes — this PR is implementation-only.
Token savings examples
wc file.py30 96 978 scripts/find_duplicate_attrs.py30L 96W 978Bwc -l file.py30 scripts/find_duplicate_attrs.py30wc -l src/*.rsTest plan
cargo fmt --all --checkpassescargo clippy --all-targetsclean (no new warnings)cargo test wc_cmd— 15/15 tests passrtk wc src/main.rs,rtk wc -l src/*.rs🤖 Generated with Claude Code