Twee is a fast and feature-rich alternative to tree
, with .gitignore awareness, file content preview (--show
), and built-in directory & file comparison (--diff
). Twee respects .gitignore
, ensuring accurate directory views of what's important.
The --show
functionality in Twee is based on the efficient "show" algorithm from showfileshere
, developed under the MIT LICENSE.
simplescreenrecorder-2025-02-19_14.17.57.mp4
Feature | twee |
tree |
eza --tree |
---|---|---|---|
Directory Tree View | β Yes | β Yes | β Yes |
File Size & Metadata (--details ) |
β Yes | β No | β Yes |
Gitignore Awareness (Always On) | β Yes | β No | β Yes |
File Differences (--diff ) |
β Yes | β No | β Yes |
File Content Preview (--show ) |
β Yes (AI-ready code extraction) | β No | β No |
PDF Text Extraction (--show pdf ) |
β (Optional) | β No | β No |
Flat View (--flat ) |
β Yes | β No | β No |
Written in C for Speed | β Yes | β No | β No |
git clone https://github.com/YOUR_USERNAME/twee.git
cd twee
make
sudo mv build/twee /usr/local/bin/twee
git clone https://github.com/YOUR_USERNAME/twee.git
cd twee
make
(Optionally move twee.exe
to a location in your PATH.)
simplescreenrecorder-2025-02-19_14.26.51.mp4
Twee supports PDF text extraction with --show pdf
, but it is not built by default.
To enable PDF reading, install poppler-glib
and build with the pdf
target:
sudo apt install libpoppler-glib-dev
sudo pacman -S poppler-glib
sudo dnf install poppler-glib-devel
brew install poppler
make pdf
Now, Twee can extract text from PDFs using:
twee --show pdf
To make twee
available globally, add it to your shell configuration:
echo 'twee() { "$HOME/twee/build/twee" "$@"; }' >> ~/.bashrc
source ~/.bashrc
[System.Environment]::SetEnvironmentVariable("Path", $Env:Path + ";C:\\path\\to\\twee", [System.EnvironmentVariableTarget]::User)
Usage: twee [options] [directory]
Options:
-h, --help Show this help message and exit
-L <level> Limit directory depth to <level>
--no-emoji Disable emojis in output
--details Show file details (size, modified date)
--ignore <name> Ignore file/directory by name (can be used multiple times)
--no-git Do not auto-ignore files listed in .gitignore
--flat Disable tree view (list as flat structure)
--show [exts] Show contents of files with given extensions (e.g., `py js md pdf`)
--head <N> Show only first N lines per file (used with --show)
--tail <N> Show only last N lines per file (used with --show)
--dif <dir1> <dir2> Compare directory structures (existence-only)
--diff <dir1> <dir2> Compare directory structures AND file contents
# Show tree of current directory
twee
# Limit depth to 2 levels
twee -L 2
# Disable emoji icons
twee --no-emoji
# Ignore multiple directories
twee --ignore node_modules --ignore build
# Compare structures between two directories
twee --dif dir1 dir2
# Compare structures AND file contents
twee --diff dir1 dir2
# Show contents of all `.py` and `.rs` files
twee --show py rs
# Show contents of PDFs (if built with PDF support)
twee --show pdf
# Show contents but limit output to first 10 lines per file
twee --show py --head 10
Twee's file content preview (--show
) is an underrated superpower; it allows structured extraction of codebases, configuration files, and entire directory snapshots for use in AI models, ChatGPT, and LLM-powered workflows π₯π€
β
Inject an entire codebase into an AI-powered assistant for context-aware debugging & refactoring
β
Extract structured content for automated documentation or static analysis
β
Feed large repositories into fine-tuned models & embeddings without copy-pasting
twee --show c h py > project_dump.txt
(Feed project_dump.txt
into ChatGPT or any LLM for deep analysis.)
Twee isn't just a tree viewerβitβs a developerβs productivity tool:
- π¨ Beautifully formatted output with emoji-based file types
- π Fast execution, even on large projects
- π οΈ Built-in directory & file comparisons, replacing
diff -rq
- π₯ Git-aware it automatically respects
.gitignore
- π File Content Previewing (
--show
) perfect for AI workflows, code analysis, and LLM-powered tools - π Optional PDF text extraction (
--show pdf
) - β‘ Written in C for speed, ensuring optimal performance
π GitHub Repository: github.com/andrewrgarcia/twee
β¨ Star the repo if you like it! π