4 releases
0.0.4 | Aug 27, 2024 |
---|---|
0.0.3 | Aug 26, 2024 |
0.0.2 | Aug 26, 2024 |
0.0.1 | Aug 26, 2024 |
#1361 in Command line utilities
30 downloads per month
29KB
690 lines
bfind
A GNU Find-like tool, but uses breadth-first search instead of depth-first search, written in Rust.
Why
- BFS prefers files that are shallower, which means files in shallower directories are more likely to be found in a shorter time.
- When encountering a subdirectory which has many very deep subdirectories, BFS doesn't stuck on it before moving to the next subdirectory.
- I want to learn Rust by making this tool.
NO WARRANTY: I make this tool mainly for my personal use. I have no plan to improve its performance or features, neither are issues guaranteed to get fixed. However, PR is welcome.
Build
$ cargo build
Or for the release version
$ cargo build --release
Install
$ cargo install --path .
Usage
NOTE: Currently, only basic directory listing is implemented.
List current working directory:
$ bfind
List a specific directory:
$ bfind /path/to/directory
Find a file with regular expression:
$ bfind . -- name match 'foo.*'
Find a file with glob:
$ bfind . -- name glob 'foo*'
Combining conditions:
$ bfind . -- name glob 'foo*' and type is dir
Print with formatting:
$ bfind . print 'file: {name:10}, {size:>10} bytes' -- name glob 'foo*' and size gt 1MiB
Execute a command:
$ bfind . exec cat '{fullpath}' -- name glob 'foo*.txt'
TODO
- Design a simple and powerful command line syntax.
- Implement the command line interface.
Dependencies
~2–10MB
~126K SLoC