|
| 1 | +<div align="center"> |
| 2 | + |
| 3 | +# 🌳 treei |
| 4 | + |
| 5 | +[](https://www.npmjs.com/package/treei) |
| 6 | +[](https://www.npmjs.com/package/treei) |
| 7 | + |
| 8 | +一个用于生成目录结构树的 Node.js 命令行工具。 |
| 9 | + |
| 10 | +[English](./README.md) | 简体中文 |
| 11 | + |
| 12 | +</div> |
| 13 | + |
| 14 | +## ✨ 特性 |
| 15 | + |
| 16 | +- 输出类似 VSCode 的友好目录树结构 |
| 17 | +- 使用不同颜色区分文件夹和文件 |
| 18 | +- 更多... |
| 19 | + |
| 20 | +## 📦 安装 |
| 21 | + |
| 22 | +```bash |
| 23 | +npm i treei -g |
| 24 | +``` |
| 25 | + |
| 26 | +## 🚀 使用方法 |
| 27 | + |
| 28 | +```bash |
| 29 | +$ treei -h |
| 30 | +Usage: treei [options] |
| 31 | + |
| 32 | +Generate a directory structure tree |
| 33 | + |
| 34 | +Options: |
| 35 | + -V, --version output the version number |
| 36 | + -i, --ignore <ig> ignore specific directory name, separated by comma or '|' |
| 37 | + -l, --layer <layer> specify the layer of output |
| 38 | + -d, --directory <dir> specify the directory to generate structure tree |
| 39 | + -f, --only-folder output folder only |
| 40 | + --icon output emoji icon, prefixing filename or directory |
| 41 | + -o, --output <output> export content into a file, appending mode by default |
| 42 | + -c, --clipboard copy the output to clipboard |
| 43 | + -h, --help display help for command |
| 44 | +``` |
| 45 | + |
| 46 | +## 📝 示例 |
| 47 | + |
| 48 | +忽略 `.git` 和 `node_modules` 目录。 |
| 49 | + |
| 50 | +```bash |
| 51 | +$ treei -i '.git|node_modules' # 或 treei -i '.git,node_modules' |
| 52 | +├──.github |
| 53 | +| └──workflows |
| 54 | +| | ├──release.yml |
| 55 | +| | └──test.yml |
| 56 | +├──.vscode |
| 57 | +| └──settings.json |
| 58 | +├──dist |
| 59 | +| └──index.js |
| 60 | +├──src |
| 61 | +| ├──config.ts |
| 62 | +| ├──generate.ts |
| 63 | +| ├──handleOptions.ts |
| 64 | +| ├──index.ts |
| 65 | +| ├──sort.ts |
| 66 | +| ├──toTree.ts |
| 67 | +| ├──type.ts |
| 68 | +| └──utils.ts |
| 69 | +├──test |
| 70 | +| ├──handleOptions.spec.ts |
| 71 | +| ├──sort.spec.ts |
| 72 | +| └──toTree.spec.ts |
| 73 | +├──.editorconfig |
| 74 | +├──.eslintrc |
| 75 | +├──.gitignore |
| 76 | +├──.prettierignore |
| 77 | +├──.prettierrc.mjs |
| 78 | +├──CHANGELOG.md |
| 79 | +├──LICENSE |
| 80 | +├──package.json |
| 81 | +├──pnpm-lock.yaml |
| 82 | +├──README.md |
| 83 | +└──tsconfig.json |
| 84 | +``` |
| 85 | + |
| 86 | +显示文件名或目录前的表情图标。 |
| 87 | + |
| 88 | +```bash |
| 89 | +$ treei -i '.git,node_modules' --icon |
| 90 | +├──📁.github |
| 91 | +| └──📁workflows |
| 92 | +| | ├──📄release.yml |
| 93 | +| | └──📄test.yml |
| 94 | +├──📁.vscode |
| 95 | +| └──📄settings.json |
| 96 | +├──📁dist |
| 97 | +| └──📄index.js |
| 98 | +├──📁src |
| 99 | +| ├──📄config.ts |
| 100 | +| ├──📄generate.ts |
| 101 | +| ├──📄handleOptions.ts |
| 102 | +| ├──📄index.ts |
| 103 | +| ├──📄sort.ts |
| 104 | +| ├──📄toTree.ts |
| 105 | +| ├──📄type.ts |
| 106 | +| └──📄utils.ts |
| 107 | +├──📁test |
| 108 | +| ├──📄handleOptions.spec.ts |
| 109 | +| ├──📄sort.spec.ts |
| 110 | +| └──📄toTree.spec.ts |
| 111 | +├──📄.editorconfig |
| 112 | +├──📄.eslintrc |
| 113 | +├──📄.gitignore |
| 114 | +├──📄.prettierignore |
| 115 | +├──📄.prettierrc.mjs |
| 116 | +├──📄CHANGELOG.md |
| 117 | +├──📄LICENSE |
| 118 | +├──📄package.json |
| 119 | +├──📄pnpm-lock.yaml |
| 120 | +├──📄README.md |
| 121 | +└──📄tsconfig.json |
| 122 | +``` |
| 123 | + |
| 124 | +将输出导出到 `result.md`,默认使用追加模式。 |
| 125 | + |
| 126 | +```bash |
| 127 | +$ treei -i '.git,node_modules' --icon -o result.md |
| 128 | +├──📁.github |
| 129 | +| └──📁workflows |
| 130 | +| | ├──📄release.yml |
| 131 | +| | └──📄test.yml |
| 132 | +├──📁.vscode |
| 133 | +| └──📄settings.json |
| 134 | +├──📁dist |
| 135 | +| └──📄index.js |
| 136 | +├──📁src |
| 137 | +| ├──📄config.ts |
| 138 | +| ├──📄generate.ts |
| 139 | +| ├──📄handleOptions.ts |
| 140 | +| ├──📄index.ts |
| 141 | +| ├──📄sort.ts |
| 142 | +| ├──📄toTree.ts |
| 143 | +| ├──📄type.ts |
| 144 | +| └──📄utils.ts |
| 145 | +├──📁test |
| 146 | +| ├──📄handleOptions.spec.ts |
| 147 | +| ├──📄sort.spec.ts |
| 148 | +| └──📄toTree.spec.ts |
| 149 | +├──📄.editorconfig |
| 150 | +├──📄.eslintrc |
| 151 | +├──📄.gitignore |
| 152 | +├──📄.prettierignore |
| 153 | +├──📄.prettierrc.mjs |
| 154 | +├──📄CHANGELOG.md |
| 155 | +├──📄LICENSE |
| 156 | +├──📄package.json |
| 157 | +├──📄pnpm-lock.yaml |
| 158 | +├──📄README.md |
| 159 | +└──📄tsconfig.json |
| 160 | +``` |
| 161 | + |
| 162 | +将输出复制到剪贴板。 |
| 163 | + |
| 164 | +```bash |
| 165 | +$ treei -i '.git,node_modules' --icon -c |
| 166 | +``` |
| 167 | + |
| 168 | +## 📄 许可证 |
| 169 | + |
| 170 | +[MIT](./LICENSE) |
0 commit comments