itree

itree is an interactively navigable version of the Linux utility tree, built in Rust. It aims to extend the functionality of tree, providing an intuitive view of a directory's structure in a manageable, interactively navigable command-line interface.

Whereas tree can be overwhelming to use on large directories, itree allows you to inspect a filesystem in an intuitive fashion, at your own pace. It also respects gitignore rules and supports folding, allowing you to focus on the files you're most interested in!

itree relies on the FS walker used by ripgrep, bringing you the usefulness of tree with as little overhead/slowdown as possible! (See benchmarks below for comparisons.)

tree | itree :-------------------------:|:-------------------------: Running <code>tree</code> from the ~/.rustup directory | Running <code>itree</code> from the ~/.rustup directory Running <code>tree</code> from this project's directory | Running <code>itree</code> from this project's directory

Installation

Using brew

itree is available via Homebrew! Simply run: $ brew install sashaweiss/projects/itree

Using cargo

itree is also available on crates.io! Simply run: $ cargo install itree

From source

To build from source, first make sure you have Rust and cargo installed. (If not, then install via Rustup.) Then: $ git clone https://github.com/sashaweiss/itree $ cd itree $ cargo install

Usage

Running itree will start an interactive CLI. Use itree --help to see a full list of configurations and UI options!

Benchmarks

Below are tables comparing the performance of itree to that of tree as well as to ripgrep (from which itree gets its filesystem iterator).

Tl;dr: itree is fast - much faster than tree, and not a huge slowdown over pure ripgrep! (Mostly thanks to BurntSushi's awesome ignore crate).

Methodology

I used hyperfine for benchmarking - specifically, the command: $ hyperfine --warmup 2 <CMD> --show-output where <CMD> was filled in with the first column of the below tables. --show-output was used to avoid suppressing the output of each command, since printing/rendering is an important part of what tree and itree do. --warmup 2 caused each command to run twice before being measured, to potentially warm up caches.

Results

Results shown are the mean and standard deviation reported by hyperfine. Each is the result of at least 10 measurements.

| Command | μ ± σ (run from my $HOME) | μ ± σ (run in this repo) | |:---|:---:|:---:| | itree --no-ignore --no-exclude --no-render | 2.953s ± 0.070s | 0.012s ± 0.002s | | itree --no-ignore --no-exclude --no-interact | 3.511s ± 0.043s | 0.031s ± 0.010s | | tree | 15.005s ± 4.891s | 0.043s ± 0.014s | | rg --no-ignore --files --quiet | 1.373s ± 0.051s | 0.010s ± 0.014s |

Future work