Skip to content

feat(find): add -mindepth option to find builtin#515

Merged
chaliy merged 1 commit intomainfrom
claude/fix-directory-counting-s6vms
Mar 10, 2026
Merged

feat(find): add -mindepth option to find builtin#515
chaliy merged 1 commit intomainfrom
claude/fix-directory-counting-s6vms

Conversation

@chaliy
Copy link
Contributor

@chaliy chaliy commented Mar 10, 2026

Summary

  • find -mindepth N was unrecognized, causing find . -mindepth 1 -type f | wc -l to return 0 (find errored on unknown predicate, producing no stdout for wc -l)
  • Added min_depth field to FindOptions, -mindepth argument parsing, and depth-gating in find_recursive to suppress output below the threshold
  • Updated spec 005-builtins.md to document -mindepth N

Test plan

  • Unit tests: test_find_mindepth, test_find_mindepth_with_type (reproduces exact reported issue), test_find_mindepth_2, test_find_mindepth_missing_arg, test_find_mindepth_invalid_value
  • Spec tests: find_mindepth, find_mindepth_2 — verified matching real bash output
  • All 1534 lib tests pass
  • cargo fmt --check clean
  • cargo clippy --all-targets --all-features -- -D warnings clean

find -mindepth N was unrecognized, causing `find . -mindepth 1 -type f | wc -l`
to output 0 (find errored on unknown predicate, producing no stdout).

Add min_depth field to FindOptions, parse -mindepth argument, and suppress
output for entries below the minimum depth threshold.

https://claude.ai/code/session_016LNVVjp5EuQXhaQRpoS6jd
@chaliy chaliy merged commit 8577b6d into main Mar 10, 2026
17 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