Skip to content

windneiro/trex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

 ████████╗██████╗ ███████╗██╗  ██╗
    ██╔══╝██╔══██╗██╔════╝╚██╗██╔╝
    ██║   ██████╔╝█████╗   ╚███╔╝ 
    ██║   ██╔══██╗██╔══╝   ██╔██╗ 
    ██║   ██║  ██║███████╗██╔╝ ██╗
    ╚═╝   ╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝

Tree Explorer - a beautiful, fast directory tree viewer for your terminal

Zig License Platform Author Version

Features

  • Colorful output - directories, files, and symlinks each have distinct colors
  • Smart sorting - alphabetical by default, with --dirs-first / --files-first
  • Pattern filtering - show only files matching a glob pattern (e.g. *.zig)
  • File sizes - human-readable sizes (B, K, M, G) with --size
  • Hidden files - toggle visibility with --all
  • Depth control - limit traversal with --depth N
  • Unicode - use --unicode for Unicode box-drawing charcters
  • No dependencies - single binary, zero runtime deps
  • Fast - written in Zig for native performance
  • Cross-platform - Linux, Windows, macOS

Preview

./my-project
├── src/
│   ├── components/
│   │   ├── Button.zig [2.1K]
│   │   └── Modal.zig  [4.8K]
│   ├── utils/
│   │   └── fmt.zig    [1.2K]
│   └── main.zig       [8.4K]
├── build.zig
└── README.md

2 directories, 6 files (16.5K total)

Installation

Pre-built binaries

Download the latest binary for your platform from Releases:

Platform File
Linux x86_64 trex-linux-x86_64
Linux arm64 trex-linux-arm64
Windows x86_64 trex-windows-x86_64.exe
Windows arm64 trex-windows-arm64.exe
macOS x86_64 trex-macos-x86_64
macOS arm64 trex-macos-arm64

Linux / macOS:

chmod +x trex-linux-x86_64
sudo mv trex-linux-x86_64 /usr/local/bin/trex

Windows: Place trex-windows-x86_64.exe somewhere in your %PATH% and rename it trex.exe.

Build from source

Requires Zig 0.13.0.

git clone https://github.com/Windneiro/trex.git
cd trex
zig build -Doptimize=ReleaseSafe
./zig-out/bin/trex

Cross-compile for all platforms:

# Linux / macOS
chmod +x build-all.sh && ./build-all.sh

# Windows
build-all.bat

Binaries are placed in ./dist/.

Usage

trex [OPTIONS] [PATH]

PATH defaults to the current directory if omitted.

Options

Flag Short Description
--help -h Show help message
--version -v Show version
--depth N -d N Max traversal depth
--all -a Show hidden files and directories
--dirs-only -D Show only directories
--size -s Show human-readable file sizes
--pattern GLOB Filter files by pattern (e.g. *.zig)
--dirs-first List directories before files
--files-first List files before directories
--full-path Print absolute path for each entry
--no-color Disable ANSI colors
--unicode Use Unicode box-drawing charcters
--count Show summary counts only

Examples

# Explore current directory
trex

# Explore a path with max depth 2
trex /home/user/projects -d 2

# Show all files (including hidden) with sizes
trex . -a -s

# Directories only, dirs listed first
trex . -D --dirs-first

# Filter only Zig source files
trex src --pattern *.zig

# Clean output for scripts (no color, ASCII lines)
trex . --no-color --ascii

# Quick count summary
trex /var --count

Project Structure

trex/
├── src/
│   └── main.zig       main source file
├── build.zig          Zig build configuration
├── build-all.sh       cross-compile script (Linux/macOS)
├── build-all.bat      cross-compile script (Windows)
└── README.md

Build Details

The default optimize mode is ReleaseSafe (safe optimizations + bounds checking). For maximum performance:

zig build -Doptimize=ReleaseFast

Cross-compilation uses Zig's built-in support - no external toolchain required.

License

MIT - see LICENSE

Made with Zig by Windneiro

About

A fast, cross-platform directory tree viewer written in Zig.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors