Plugin catalog

tree_summary

Adds recursive file, directory and byte totals beside each directory in the tree view.

↓ on this page

tree_summary adds recursive file, directory and byte totals beside each directory in the tree view. Turn it on when you want to see what a directory holds without expanding it.

lla -t -d 2 sdk

Turn it on

# ~/.config/lla/config.toml
enabled_plugins = ["tree_summary"]

Or run lla --enable-plugin tree_summary, which writes the same setting, so it stays on. lla --disable-plugin tree_summary removes it.

The plugin only runs in the tree view (-t). Totals cover the whole subtree whatever -d you pass. They don't count the directory itself and don't follow symlinks.

Directories get three typed fields: tree_file_count (integer), tree_directory_count (integer) and tree_total_bytes (bytes). Read them from JSON, and keep -t in the command, since lla --json alone leaves them out:

lla -t -d 2 --json sdk | jq -c '.[] | select(.plugin.tree_total_bytes) | {name, bytes: .plugin.tree_total_bytes, files: .plugin.tree_file_count}'
{"name":"sdk","bytes":35486,"files":13}
{"name":"wit","bytes":464,"files":1}
{"name":"tests","bytes":2319,"files":9}

field: columns stay empty, because the long and table views don't run this plugin.

Actions

Run an action with lla plugin run tree_summary <action>.

ActionWhat it does
inspect -- <path>Calculate recursive totals for a directory

inspect isn't interactive, so it works in scripts and prints JSON without a TTY. A path that isn't a directory fails with path is not a readable directory.

Example

lla -t -d 2 sdk
└── sdk/ [13 files · 10 dirs · 34.7 KiB]
    ├── Cargo.toml
    ├── README.md
    ├── src/ [1 files · 0 dirs · 30.2 KiB]
    │   └── lib.rs
    ├── tests/ [9 files · 7 dirs · 2.3 KiB]
    │   └── fixtures/ [9 files · 6 dirs · 2.3 KiB]
    └── wit/ [1 files · 0 dirs · 464 B]
        └── lla-plugin.wit
lla plugin run tree_summary inspect -- sdk
{
  "bytes": 35486,
  "directories": 10,
  "files": 13,
  "path": "sdk"
}