この資料は Rust 製のコマンドラインツール as-tree について紹介するものです。
Rustの環境構築やツールのインストール方法については以下を参照してください
as-tree は標準入力からパスのリストをうけとり、標準出力にツリーとして表示するツールです。
GitHub - jez/as-tree: Print a list of paths as a tree of paths 🌳
as-tree のインストールは次のように行います。
% cargo install -f --git <https://github.com/jez/as-tree>
このツールは、fd のようなツールと組み合わせると非常に便利になり、tree 単独よりもうまくファイルをリストすることができます。
% fd --exclude test | as-tree
.
├── LICENSE.md
├── Makefile
├── README.md
├── WORKSPACE
├── bazel
├── main
│ ├── BUILD
│ └── main.cc
├── third_party
│ ├── BUILD
│ ├── externals.bzl
│ └── spdlog.BUILD
└── tools
├── BUILD
├── clang.bzl
└── scripts
├── build_compilation_db.sh
└── generate_compdb_targets.sh
as-tree のヘルプメッセージ
% as-tree --help
Print a list of paths as a tree of paths.
Usage:
as-tree [options] [<filename>]
Arguments:
<filename> The file to read from. When omitted, reads from stdin.
Options:
--color (always|auto|never)
Whether to colorize the output [default: auto]
-f Prints the full path prefix for each file.
-h, --help Print this help message
-v, --version Print the version and exit
Example:
find . -name '*.txt' | as-tree