rust_tree 0.1.0

tree is a cross-platform tree application and library that produces an indented directory listing of files.
Documentation

tree

tree is a command-line utility that recursively displays the directory structure of a given path in a tree-like format, inspired by the Unix tree command. It is implemented in Rust and aims to provide a fast and efficient alternative with additional features.

Tree Example

Features

  • Display directory structure in a tree-like format
  • Control the depth of recursion with the -L flag
  • Show full path with the -f flag
  • No indentation with the -i flag
  • Display hidden files with the -a flag
  • Include specific files matching patterns with the -P flag
  • Display the size of each file with the -s flag
  • Display the total size of each directory with the -h flagS
  • Colorize output with the -C flag
  • Turn Colorization off with the -n flag
  • Exclude specific files matching patterns with the -I flag
  • Send output to filename with -o flag
  • Do not descend directories that contain more a more than # entries with --filelimit flag
  • List directories first before files with dirsfirst flag

Installation

Download Binaries

Binaries for various platforms are available on the GitHub Releases (Windows, MacOS, Linux) page.

Build from Source

If you have Rust and Cargo installed, you can build the project by running:

git clone https://github.com/peteretelej/tree.git
cd tree
cargo build --release

The resulting binary will be located at ./target/release/tree.

Usage

./tree [FLAGS] [OPTIONS] [PATH]

For example

./tree -L 2 .

# -L 2: displays upto 2 levels of recursion

Using as Rust Crate

use rust_tree::tree::{list_directory, options::TreeOptions};

fn main() {
    let path = ".";
    let options = TreeOptions::default();
    list_directory(path, &options).unwrap();
}

Disclaimer

Using this project to learn Rust, so it's not production ready. Feel free to PR for any improvements.

Contributing

Contributions are welcome! If you have any suggestions, feature requests, or bug reports, please feel free to open an issue or submit a pull request on the GitHub repository.

License

This project is licensed under the MIT License.