Skip to content

feat(sort,uniq,cut,tr): add sort/uniq/cut/tr missing options#228

Merged
chaliy merged 2 commits intomainfrom
claude/bashkit-bash-compatibility-BsDKD
Feb 23, 2026
Merged

feat(sort,uniq,cut,tr): add sort/uniq/cut/tr missing options#228
chaliy merged 2 commits intomainfrom
claude/bashkit-bash-compatibility-BsDKD

Conversation

@chaliy
Copy link
Contributor

@chaliy chaliy commented Feb 23, 2026

Summary

  • cut: Add -c char mode, -s only delimited, --complement, --output-delimiter
  • tr: Add -s squeeze, -c complement, combined flags parsing (-cd, -ds)
  • sort: Add -t delimiter, -k key field (with n/r suffix), -s stable, -c check sorted, -h human numeric, -M month, -o output file
  • uniq: Add -i case insensitive, -f skip fields (including -fN combined form)

Removes 24 skip markers from cut/tr spec tests and 12 from sort/uniq spec tests. Adds 4 new spec test cases and 16 new unit tests.

Test plan

  • cargo fmt --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test --all-features — all 14 spec tests pass
  • 20 unit tests for sort/uniq pass
  • cuttr spec tests pass (24 previously-skipped tests now active)
  • sortuniq spec tests pass (12 previously-skipped tests now active)

Cut improvements:
- Add -c character mode (cut -c1-5, -c1,3,5, -c3-, -c-3)
- Add -s (only delimited lines)
- Add --complement (invert selection)
- Add --output-delimiter
- Support open-ended ranges: f3- (field to end), -f3 (from start)
- Refactor field parsing with Position enum for flexible ranges

Tr improvements:
- Add -s (squeeze repeated characters)
- Add -c (complement set)
- Support combined flags (-cd, -ds)
- Fix trailing newline: tests now use printf with \n

Remove 24 skip markers from cuttr spec tests.
Add 5 new unit tests for cut/tr features.
Add field delimiter (-t), key field (-k with n/r suffix), stable sort (-s),
check sorted (-c), human numeric sort (-h), month sort (-M), and output
file (-o) to sort builtin. Add case insensitive (-i) and skip fields (-f)
to uniq builtin. Remove 12 skip markers, add 4 new spec tests and 11
unit tests.

https://claude.ai/code/session_012rzB3FRw7yoQWCG1mxyW7J
@chaliy chaliy changed the title feat(cut,tr): add cut -c char mode, tr -s/-c, complement, char classes feat(sort,uniq,cut,tr): add sort/uniq/cut/tr missing options Feb 23, 2026
@chaliy chaliy merged commit 650cad2 into main Feb 23, 2026
16 checks passed
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.

2 participants