# stree **Repository Path**: stackcn/stree ## Basic Information - **Project Name**: stree - **Description**: 简单的打印目录树结构 - **Primary Language**: Rust - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2025-02-23 - **Last Updated**: 2025-02-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: 文件树, tree ## README # stree - 终端目录树生成工具 ![Rust](https://img.shields.io/badge/Rust-1.70%2B-blue) ![License](https://img.shields.io/badge/License-MIT-orange) 一个Rust实现的终端目录树生成工具,支持类似`tree`命令的可视化输出,提供丰富的自定义选项。 ## 功能特性 ✅ 树状结构展示目录层级 ✅ 支持自定义遍历深度 ✅ 自动跳过隐藏文件/目录(跨平台支持) ✅ 显示文件类型图标(📁目录/📄文件) ## 安装 ### 通过Cargo安装 ``` bash cargo install stree ``` ### 从源码构建 ``` bash git clone https://gitee.com/stackcn/stree cd stree cargo build --release ``` ## 使用说明 ### 基本命令 ``` bash stree [OPTIONS] ``` ### 参数说明 | 参数 | 描述 | 默认值 | |-----------------|-----------------------------|--------| | `-h, --help` | 显示帮助信息 | - | | `-V, --version` | 显示版本号 | - | | `-d, --max-depth` | 最大遍历深度 | 3 | | `--show-icon` | 显示文件类型图标 | false | | `-s, --skip-hidden` | 跳过隐藏文件/目录 | true | ### 使用示例 ``` bash # 默认显示(深度3,隐藏文件,无图标) stree # 显示5层深度 stree --max-depth 5 # 启用图标显示 stree --show-icon # 包含隐藏文件 stree --skip-hidden false # 组合使用 stree --max-depth 4 --show-icon ``` ## 输出示例 ```text └─ 📁 src └─ 📄 main.rs └─ 📁 target ├─ 📁 debug ├─ 📁 release └─ 📄 CACHEDIR.TAG └─ 📄 Cargo.lock └─ 📄 Cargo.toml └─ 📄 README.md ``` ## 注意事项 1. 隐藏文件检测逻辑:以`.`开头的文件/目录(Linux/Mac)和系统隐藏属性文件(Windows) 2. 图标显示功能需终端支持Unicode字符 3. 默认忽略当前目录下的.git目录 ## 许可证 [MIT License](LICENSE) ```