Reference

Command Syntax

treemand <cli> [flags]
treemand version
treemand cache [clear|list]

Global Flags

FlagShortDefaultDescription
--interactive-ifalseLaunch interactive TUI explorer
--strategy-shelpDiscovery strategies: help, man, completions (comma-separated)
--depth-1Max tree depth (-1 = unlimited)
--filterOnly show nodes whose name matches pattern
--excludeExclude nodes whose name matches pattern
--commands-onlyfalseHide flags and positional arguments
--full-pathfalseShow full command paths in tree
--outputtextOutput format: text, json, or yaml
--tree-styledefaultTree presentation: default, columns, compact, graph
--iconsunicodeIcon preset: unicode, ascii, nerd
--line-length80Max description chars before truncation
--no-colorfalseDisable color output
--no-cachefalseSkip cache lookup and write
--timeout30Discovery timeout in seconds
--debugfalseEnable debug logging to stderr

Subcommands

version

Print version, git commit, and build date.

treemand version
# treemand v0.3.0 (abc1234) built 2026-01-01

cache

Manage the discovery cache (~/.treemand/cache.db).

treemand cache list           # List cached entries with age and size
treemand cache clear <cli>    # Remove one CLI's cached entry
treemand cache clear          # Remove all cached entries

Output Formats

treemand supports three output modes. The default is a colored tree for terminals; JSON and YAML are intended for scripting, diffing, and tool integration.

treemand git                     # colored text tree (default)
treemand --output=json git       # full tree as JSON
treemand --output=yaml git       # full tree as YAML (same structure)

JSON / YAML Schema

Both JSON and YAML output share the same structure:

{
  "name": "git",
  "description": "the stupid content tracker",
  "flags": [
    {"name": "--version", "value_type": "bool", "description": "Print version"}
  ],
  "positionals": [],
  "children": [
    {
      "name": "commit",
      "description": "Record changes to the repository",
      "flags": [
        {"name": "--message", "value_type": "string", "description": "Commit message"},
        {"name": "--all", "value_type": "bool", "description": "Stage modified files"}
      ],
      "positionals": [
        {"name": "pathspec", "required": false}
      ],
      "children": []
    }
  ]
}

Pipe JSON to jq for extraction:

treemand --output=json git | jq '.children[].name'       # list subcommands
treemand --output=json git | jq '.children[] | select(.name == "commit") | .flags[].name'

Tree Display Styles

treemand supports four presentation styles. In the TUI, press T to cycle through them; from the command line, use --tree-style:

default โ€” icon-prefixed tree with inline flag pills

โ–ผ git  the stupid content tracker
โ”œโ”€โ”€ โ–ผ remote [--verbose]  Manage set of tracked repositories
โ”‚   โ”œโ”€โ”€ โ€ข add <name> <url>  Add a remote
โ”‚   โ””โ”€โ”€ โ€ข remove <name>  Remove a remote
โ”œโ”€โ”€ โ€ข commit [--message=<string>, --all]  Record changes
โ””โ”€โ”€ โ€ข status [--short, --branch]  Show working tree status

columns โ€” name ยท description alignment

  git                ยท the stupid content tracker
    remote           ยท Manage set of tracked repositories
      add            ยท Add a remote
      remove         ยท Remove a remote
    commit           ยท Record changes
    status           ยท Show working tree status

compact โ€” maximum density (no icons, no flags)

  git
    remote
      add
      remove
    commit
    status

graph โ€” classic tree connectors

โ””โ”€โ”€ git
    โ”œโ”€โ”€ remote
    โ”‚   โ”œโ”€โ”€ add
    โ”‚   โ””โ”€โ”€ remove
    โ”œโ”€โ”€ commit
    โ””โ”€โ”€ status

Non-Interactive Output

The default output is a Unicode tree with icons:

IconMeaning
โ–ผCommand with children (expanded)
โ–ถCommand with children (collapsed, TUI only)
โ€ขLeaf command (no subcommands)

Use --icons=ascii for terminals without Unicode, or --icons=nerd for Nerd Font glyphs.

Interactive TUI (-i)

treemand -i git

What the TUI Does

The TUI lets you explore a CLI’s command tree and assemble a specific command interactively. The workflow:

  1. Browse โ€” navigate subcommands with โ†“/โ†‘ (or j/k)
  2. Expand โ€” press โ†’ to open a node; press again to enter children
  3. Pick a command โ€” press Enter to set it in the preview bar
  4. Add flags โ€” press f to open the flag picker, or Enter on a flag row
  5. Fill positionals โ€” press Enter on a positional to open an input prompt
  6. Copy or run โ€” press Ctrl+E to copy the assembled command or run it

The preview bar at the top updates live as you build the command.

Layout

โ”Œโ”€ โ–บ git remote add โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   (live command preview โ€” updates as you pick items)  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ”Œโ”€ Tree: git โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”Œโ”€ Help: remote โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ โ–ผ git                     โ”‚โ”‚ Manage set of tracked    โ”‚
โ”‚   โ–ผ remote                โ”‚โ”‚ repositories.            โ”‚
โ”‚ โ–บ โ€ข add <name> <url>      โ”‚โ”‚                          โ”‚
โ”‚   โ€ข remove <name>         โ”‚โ”‚ --verbose (-v)           โ”‚
โ”‚   โ€ข get-url <name>        โ”‚โ”‚   Be verbose             โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  git remote add  [arrows]  โ†:collapse  โ†’:expand  H:help  q:quit

Keyboard Controls

Keys (arrows)Keys (vim)Keys (WASD)Action
โ†‘ / โ†“k / jw / sMove up / down (cursor only โ€” never auto-expands)
โ†’ldExpand node and stay (1st); enter first child (2nd)
โ†haCollapse node and stay (1st); go to parent (2nd)
Shift+โ†’Shift+LShift+DExpand entire subtree (at root = expand all)
Shift+โ†Shift+HShift+ACollapse entire subtree (at root = collapse all)

This matches the VS Code / macOS Finder tree model. To collapse a node and move to its sibling: press โ† (collapse), then โ†“ (next sibling).

Toggle navigation scheme with Ctrl+S (cycles: arrows โ†’ vim โ†’ WASD).

Tree Operations

KeyAction
/Fuzzy filter tree nodes
RRefresh / re-discover current node
FOpen flags modal for current node
SToggle section headers (Sub commands, Flags, Inherited flags)
TCycle display style (default โ†’ columns โ†’ compact โ†’ graph)

Building Commands

KeyAction
EnterOn a command: set it in the preview. On a flag: add it. On a positional: open input prompt.
fOpen flag picker โ€” browse all flags for the current command with search
BackspaceRemove last token from the preview
Ctrl+ECopy the assembled command to your clipboard, or run it (confirmation prompt)
Esc / qQuit (copies command to clipboard as fallback)

View Controls

KeyAction
HToggle help pane (shows --help output for selected node)
TabCycle pane focus (tree โ†’ help โ†’ preview)
?Show all key bindings modal
d / DOpen docs URL in browser (if detected in help text)

Mouse

InteractionAction
Click nodeSelect node
Click โ–ถ/โ–ผToggle expand/collapse
ScrollScroll the focused pane

Flags Modal (f)

Press f on any command node to open an interactive flag selector:

Positionals

When a command has positional arguments (e.g. git remote add <name> <url>), navigate to the positional row and press Enter to open an input prompt. The value is appended to the preview bar.

Caching

Discovery results are cached in an SQLite database:

PropertyValue
Location~/.treemand/cache.db
TTL24 hours
KeyCLI name + version + strategies
Schemav8
treemand --no-cache docker           # skip the cache for this run
treemand cache list                  # show cached CLIs
treemand cache clear git             # clear one entry

Discovery Strategies

help (default)

Recursively runs <cli> --help / <cli> <subcmd> --help to build the tree. Falls back to <cli> help <subcmd>, man page lookup, and error output mining.

man

Parses the man page for the CLI (if available) using man <cli> and stripping groff formatting. Provides richer descriptions than --help for many Unix tools.

completions

Uses shell completion output (<cli> __complete, <cli> completion) to enumerate subcommands without executing --help for every node.

treemand -s help git          # default
treemand -s man git           # man page parser
treemand -s help,man git      # combine strategies, merge results

Configuration

treemand reads ~/.config/treemand/config.yaml or ~/.treemand/config.yaml:

icons: ascii          # unicode (default) | ascii | nerd
desc_line_length: 80  # max chars before description is truncated
stub_threshold: 50    # subcommand count before switching to stub nodes

colors:
  subcmd: "#5EA4F5"
  flag: "#50FA7B"

Precedence: CLI flags > environment variables > config file > defaults.

Color Scheme

ElementDefault
Base commandbold white #FFFFFF
Subcommandblue #5EA4F5
Flag (bool)green #50FA7B
Flag (string)cyan #8BE9FD
Flag (int)orange #FFB86C
Flag (other)purple #BD93F9
Positionalyellow #F1FA8C
Invalid/errorred #FF5555
Selected bgcyan #00BFFF
Selected textblack #000000

Self-Dogfooding

treemand treemand          # explore treemand's own command tree
treemand -i treemand       # interactively explore treemand itself