Commands

Explore what each treemand command does, with short animated demos for each.

CommandWhat it does
Tree outputDiscover and display any CLI’s command hierarchy
Output formatsJSON and YAML for scripting and tooling
Interactive TUIKeyboard-driven explorer โ€” browse, pick flags, run commands
cacheList and clear the discovery cache
configView, validate, and change configuration
versionPrint version and build info
completionGenerate shell completion scripts

Tree Output

Tree Output

treemand <cli> discovers any CLI’s full command hierarchy and renders it as a color-coded tree. Point it at anything: git, kubectl, docker, aws, your own tools.

treemand tree demo

Basic usage

treemand git                        # full tree at default depth (3)
treemand --depth=2 kubectl          # limit recursion depth
treemand --filter=remote git        # only show nodes matching pattern
treemand --exclude=help git         # hide nodes matching pattern
treemand --commands-only kubectl    # subcommands only โ€” no flags or positionals

Display styles

Four styles, switchable with --tree-style or T inside the TUI:

Output Formats

Output Formats

treemand can emit the discovered tree as JSON or YAML for scripting, diffing, and integration with other tools.

treemand JSON/YAML output demo

Usage

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

JSON schema

{
  "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", "short_name": "m", "value_type": "string"}
      ],
      "positionals": [],
      "children": []
    }
  ]
}

Scripting with jq

# List all top-level subcommands
treemand --output=json --depth=1 git | jq '[.children[].name]'

# Find all flags of a specific subcommand
treemand --output=json git | jq '
  .children[] | select(.name == "commit") | .flags[].name'

# Count flags per subcommand
treemand --output=json --depth=1 kubectl | jq '
  [.children[] | {cmd: .name, flags: (.flags | length)}]'

# Extract commands with descriptions
treemand --output=json --depth=1 docker | jq '
  [.children[] | {name, description}]'

Combine with other tools

# Store a CLI's schema as YAML
treemand --output=yaml kubectl > kubectl-schema.yaml

# Diff two versions of a CLI's command surface
treemand --output=json --depth=3 aws > aws-before.json
# (upgrade aws cli)
treemand --no-cache --output=json --depth=3 aws > aws-after.json
diff aws-before.json aws-after.json

Interactive TUI

Interactive TUI (-i)

The interactive mode launches a full-screen terminal explorer with three panes: a live preview bar, a navigable tree pane, and a help pane that shows --help output for the currently selected node.

treemand TUI demo

Launch

treemand -i git
treemand -i kubectl
treemand -i docker

Workflow

  1. Navigate โ€” โ†“/โ†‘ (or j/k) to browse; cursor never auto-expands
  2. Expand โ€” โ†’ opens a node, press again to enter its children
  3. Pick a command โ€” Enter sets it in the preview bar
  4. Add flags โ€” f to open the flag picker; Enter on a flag row adds it directly
  5. Fill positionals โ€” Enter on a positional row opens an input prompt
  6. Copy or run โ€” Ctrl+E opens a confirmation modal: copy to clipboard or execute

Key bindings

Keys (arrows)Keys (vim)Keys (WASD)Action
โ†‘ / โ†“k / jw / sMove up / down
โ†’ldExpand node; enter children on 2nd press
โ†haCollapse node; go to parent on 2nd press
Shift+โ†’Shift+LShift+DExpand entire subtree
Shift+โ†Shift+HShift+ACollapse entire subtree
ggJump to top
GJump to bottom

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

cache

treemand cache

treemand caches discovered CLI trees in an SQLite database so repeat lookups are instant. The cache subcommand lets you inspect and manage those entries.

treemand cache demo

Commands

treemand cache list           # list all cached CLIs with age and size
treemand cache clear git      # clear the cached entry for git
treemand cache clear          # clear all cached entries

Cache details

PropertyValue
Location~/.treemand/cache.db
FormatSQLite
TTL24 hours
Cache keyCLI name + version string + discovery strategies

Bypassing the cache

treemand --no-cache docker       # skip cache for this run
TREEMAND_CACHE_DIR=/tmp treemand git   # use a custom cache directory

The cache key includes the CLI’s version string (from <cli> --version), so updating a CLI automatically invalidates its cached tree on the next run.

config

treemand config

Manage treemand’s optional YAML configuration file without opening it manually.

treemand config demo

Commands

treemand config view               # show merged config + file path
treemand config validate           # check for errors or unknown keys
treemand config validate --strict  # treat warnings as errors
treemand config set <key> <value>  # write a value to the config file
treemand config init               # create a commented default config
treemand config init --force       # overwrite an existing config
treemand config path               # print the config file path
treemand config edit               # open config in $EDITOR

Config file locations

treemand searches for the config file in this order:

version

treemand version

Print the version, git commit, and build date of the installed binary.

treemand version demo

Usage

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

The version is embedded at build time from the git tag (git describe --tags). Development builds show dev when no tag is present.

completion

treemand completion

Generate shell completion scripts for bash, zsh, fish, or PowerShell. Once set up, pressing Tab after treemand suggests CLIs you’ve already explored from the cache.

treemand completion demo

Setup

Bash

# Add to ~/.bashrc
source <(treemand completion bash)

Zsh

# Add to ~/.zshrc
source <(treemand completion zsh)

Fish

treemand completion fish > ~/.config/fish/completions/treemand.fish

PowerShell

# Add to your PowerShell profile
treemand completion powershell | Out-String | Invoke-Expression

How it works

The completion script hooks into your shell’s completion system. When you type treemand [Tab], it suggests CLI names from the discovery cache โ€” so the more CLIs you explore, the more useful tab-completion becomes.