Skip to main content

Overview

Proxy for the tree command with intelligent output filtering and compaction.

Syntax

rtk tree [OPTIONS] [DIRECTORY]

Options

All native tree flags are supported and passed through:
-L <level>
number
Descend only level directories deep
-d
flag
List directories only
-a
flag
Show all files (including hidden)
-I <pattern>
string
Exclude files matching pattern
-P <pattern>
string
List only files matching pattern
--gitignore
flag
Filter files according to .gitignore

Examples

Basic Tree

rtk tree
Output:
.
├── src/
│   ├── main.rs
│   ├── lib.rs
│   └── utils.rs
├── Cargo.toml
└── README.md

1 directory, 5 files

Limited Depth

rtk tree -L 2

Directories Only

rtk tree -d
Output:
.
├── src
├── tests
└── docs

3 directories

Features

  • Gitignore-aware: Automatically respects .gitignore patterns
  • Compact output: Removes excessive whitespace and formatting
  • Token-optimized: Aggregates file counts, truncates deep trees

Token Savings

Average token reduction: 60%

Implementation

Source: src/tree.rs