增强版 tree 命令 - 跨平台目录树显示工具,类似 Linux 的 tree 命令
Project description
zhtree
增强版 tree 命令 - 跨平台目录树显示工具,类似 Linux 的 tree 命令。此版本只显示名称,不显示任何图标。
功能特性
- 🌳 跨平台支持(Windows、Linux、macOS)
- 📁 显示目录树结构
- 🔍 支持多种过滤选项(排除目录、文件、扩展名)
- 📊 显示文件大小和修改时间
- 💾 支持输出到文件
- 📈 统计信息显示
安装
从 PyPI 安装(推荐)
pip install zhtree
从源码安装
git clone https://github.com/yourusername/zhtree.git
cd zhtree
pip install .
使用方法
基本用法
# 显示当前目录结构
tree
# 显示指定目录
tree C:\Users
tree /home/user
# 限制显示深度
tree -L 2
# 只显示目录
tree -d
# 显示隐藏文件
tree -a
# 显示文件大小
tree -s
# 显示修改时间
tree -t
# 同时显示大小和时间
tree -s -t
# 保存到文件
tree -o tree.txt
高级用法
# 排除指定目录
tree --exclude-dir .git --exclude-dir node_modules
# 排除指定扩展名
tree --exclude-ext .pyc --exclude-ext .log
# 排除指定文件
tree --exclude-file foo.py --exclude-file bar.txt
# 显示统计信息
tree --stats
# 显示详细信息(包括错误信息)
tree -v
命令行选项
| 选项 | 说明 |
|---|---|
path |
目标目录路径(默认为当前目录) |
-L, --level |
显示深度限制(默认:99) |
-d, --dir-only |
只显示目录 |
-a, --all |
显示隐藏文件 |
-s, --size |
显示文件大小 |
-t, --time |
显示修改时间 |
-o, --output |
输出到文件 |
--stats |
显示统计信息 |
-v, --verbose |
显示详细信息 |
--exclude-dir |
排除目录(可多次使用) |
--exclude-ext |
排除扩展名(可多次使用) |
--exclude-file |
排除文件(可多次使用) |
示例输出
目录结构: D:\project
================================
project/
├── src/
│ ├── main.py (2.5 KB) [2024-01-15 10:30]
│ └── utils.py (1.2 KB) [2024-01-14 15:20]
├── tests/
│ └── test_main.py (0.8 KB) [2024-01-13 09:15]
├── README.md (3.1 KB) [2024-01-16 14:45]
└── requirements.txt (0.2 KB) [2024-01-10 11:00]
开发
# 克隆仓库
git clone https://github.com/yourusername/zhtree.git
cd zhtree
# 安装开发依赖
pip install -e .
# 运行测试
python tree.py
许可证
MIT License
贡献
欢迎提交 Issue 和 Pull Request!
作者
Your Name
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
No source distribution files available for this release.See tutorial on generating distribution archives.
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
zhtree-0.1.0-py3-none-any.whl
(14.1 kB
view details)
File details
Details for the file zhtree-0.1.0-py3-none-any.whl.
File metadata
- Download URL: zhtree-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e1e5b0cbb871a65d7b3cd44922cd295895056535f28fa7f4ebf395b59fcf78fa
|
|
| MD5 |
b89d9cf632bb9d724d4ca3a01f87775d
|
|
| BLAKE2b-256 |
813270576a02fdd52e6be4168c95b69a79c2a7622d08264bd381ff389d690129
|