A rewrite of tree in Rust.
Restrictions:
- no modifications to original C code
- avoid using any external crates unless absolutely necessary
- don't blindly replicate or copy the original C code but take inspiration (use Rust types)
- read arguments from the terminal when called
- print matching (roughly, most flags won't be supported) usage when
--help
is used - return exit code 0
- print version string (bonus: take from Cargo.toml)
- handle unsupported argument. Print
Invalid argument \
--arg`` & usage and return exit code 2 - write a rust test to confirm the behaviour
- when called with no args, print
X directories, Y files
- display tree view of directories & files in current working dir
- sort by name (default behaviour)
- support
-a
option (show all files including hidden) - support
-d
option (list directories only) - if any directory cannot be opened (permission, etc), return exit code 2. Else return 0 on success
- support arbitrary list of directories as positional args and perform tree search & display
- when multiple directories are used, the count of dirs & files includes all locations
- support
-l
option (list directories only) - write integration test, assert C
tree
==tree-rs