Command line¶
arbol [OPTIONS] [PATH]
PATH is a directory to walk or a JSON file to read, and defaults to the
current directory. Arbol works out which it is; there is no mode flag.
| Option | Description |
|---|---|
-a, --all |
Show hidden entries: dot names, and dunder folders |
-L, --level |
Maximum display depth, counting levels below the root |
-I, --ignore |
Wildcard pattern to skip, at any depth. Repeatable |
-o, --output |
Save the intermediate JSON here instead of a temporary file |
-V, --version |
Show the version and exit |
Hidden entries are skipped by default: anything starting with a dot, plus
dunder folders like __pycache__. So the common case needs no flags:
arbol .
-a turns that off and shows everything, matching tree -a:
arbol . -a
-I handles whatever the default does not cover. See
Ignore patterns for the full syntax.
Depth¶
-L counts levels below the root, so -L 1 is the root's own entries. A
directory cut off at the limit simply stops, with no marker distinguishing it
from a file — the same thing tree -L does. -L 0 is an error, again as in
tree.
Saving and drawing JSON¶
-o writes the walked structure to a file instead of a temporary one:
arbol . -o tree.json
Point arbol at that file to draw it again, edits and all:
arbol tree.json
See use case 2 for the edit-and-redraw workflow, and use case 3 for JSON that never came from a filesystem.
The format¶
ROOT names the root node and is not drawn as a branch. Everything else
follows three rules: an object contributes one branch per key, an array
contributes one child per item, and anything else becomes a leaf.
For a walked directory that means a directory is a list of entries, a
file is a string in that list, and a subdirectory is a single-key dict,
{"name": [...]}.
Files have two representations
At the top level every entry is a dict key, so a top-level file is
written "README.md": [] — an empty list renders as a leaf. A nested file
is a plain string inside its parent's list. Worth knowing before you edit
one by hand.
Two things about saving¶
- The file holds what was walked. Hidden entries are absent unless you save
with
-a. ROOTrecords the real directory name, not the path you typed.arbol . -o tree.jsondisplays.but writes"ROOT": "myproject".
Walk options do not apply to JSON input
-L, -I, -a and -o describe a walk, and reading a JSON file involves
no walk. Passing them with a JSON file is an error rather than a silent
no-op, which would be a trap.
For JSON input the root is labelled by the document's own ROOT, not by the
file path.