A CLI that displays source file counts in a tree view by directory and language
Project description
treestat
Command-line tool that shows source file counts per directory and language in a tree view.
- Flexible filtering: language presets via
--langor custom extensions via--ext. - Configurable counting: only direct files in each directory (
direct) or full subtree aggregation (tree). - Script‑friendly output: human‑readable text or stable JSON for CI, dashboards, and scripts.
⚙️ Installation
The recommended way to install treestat is via uv so that it is managed as a Python tool:
uv tool install treestat-cli
Or install from PyPI:
pip install treestat-cli
You can also install the native Rust binary from crates.io:
cargo install treestat
🚀 Usage
Count C/C++ files up to depth 3 under the current directory:
treestat . --lang c,cpp --max-depth 3
Example (text) output:
all file statistics (Tree View):
============================================================
llvm-project/ (52970 files)
├── bolt/ (241 files)
├── clang/ (18264 files)
├── clang-tools-extra/ (3003 files)
├── compiler-rt/ (3417 files)
├── cross-project-tests/ (228 files)
├── flang/ (665 files)
├── libc/ (1959 files)
├── libclc/ (248 files)
├── libcxx/ (9179 files)
├── libcxxabi/ (105 files)
├── libunwind/ (43 files)
├── lld/ (219 files)
├── lldb/ (4765 files)
├── llvm/ (6866 files)
├── llvm-libgcc/ (2 files)
├── mlir/ (1873 files)
├── openmp/ (744 files)
├── polly/ (893 files)
├── pstl/ (97 files)
├── third-party/ (154 files)
└── utils/ (5 files)
============================================================
Total matching files: 52970
Directories containing files: 6516
Languages (Top 5): c=12000,c++=38000,python=2970
To get JSON for automation:
treestat . --lang rust --format json --json-pretty
📚 CLI reference
treestat [PATH] [OPTIONS]
PATH: target directory (default:.)--lang <LANG[,LANG...]>: language preset(s) from embedded Linguist data (repeatable, aliases supported)--ext <LIST>: custom extensions (comma-separated, supportsrsor.rs)--headers <include|exclude|only>: header-file policy (default:include)--count-mode <direct|tree>: counting mode (default:tree)--max-depth <N>: maximum directory depth (root=0)--min-count <N>: hide directories below this count--show-empty: include0 filesdirectories--follow-symlinks: follow symlinks (default: disabled)--exclude <PATTERN>: exclude path pattern (repeatable)--no-gitignore: disable.gitignore-based filtering--hidden: include hidden files/directories--format <text|json>: output format (default:text)--json-pretty: pretty-print JSON
⚖️ Default behavior
.gitignorepatterns are enabled by default.- Hidden entries are excluded by default unless
--hiddenis set. - Common build/output directories are excluded by default:
.git,target,build,out,node_modules,third_party,dist. dirs_with_filesdoes not include the root directory.
🧪 Development
cargo fmt
cargo clippy --all-targets --all-features -- -D warnings
cargo test
📜 License
MIT License. See LICENSE for details.
🤝 Contributing
Contributions are welcome! Feel free to open an issue or submit a pull request.
📞 Support
- GitHub Issues: Report a bug
- GitHub README: View the latest docs
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file treestat_cli-1.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: treestat_cli-1.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 502.5 kB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d51c5ec0fabfaeca2c8802eaa453dc2a134ace379ff24d77828e6488bf81550d
|
|
| MD5 |
ef6ac8f642f96d5a6c7fc12618d6c58e
|
|
| BLAKE2b-256 |
7dfa0818287106e55ffeca0acaf47f02892d20aa5e42681e8973d064f3659399
|
Provenance
The following attestation bundles were made for treestat_cli-1.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
publish-pypi.yml on chouzz/treestat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
treestat_cli-1.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
d51c5ec0fabfaeca2c8802eaa453dc2a134ace379ff24d77828e6488bf81550d - Sigstore transparency entry: 1109225160
- Sigstore integration time:
-
Permalink:
chouzz/treestat@1b5b212f0d539e67dc4b9f8e0da27003abd27e97 -
Branch / Tag:
refs/tags/v1.1.0 - Owner: https://github.com/chouzz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@1b5b212f0d539e67dc4b9f8e0da27003abd27e97 -
Trigger Event:
push
-
Statement type: