treeparse

Examples

Common patterns and living examples in the repo.

Examples

All examples are executable and live in examples/.

Run with the editable install:

uv run --with-editable . python examples/basic.py --help
uv run --with-editable . python examples/demo.py

Notable Examples

  • basic.py — minimal cli + command
  • basic_super.py — using subgroups
  • chain_demo.py — pipeline example
  • group_option_demo.py / group_arg_demo.py — inheritance
  • all_themes_demo.py — theme switcher (see Themes for full color theme outputs)
  • theme_demo.py, github_theme_demo.py, monokai_theme_demo.py
  • validation_error_demo.py — error cases
  • fix_*.py — demonstrations of fixes / edge cases

See scripts/demos.sh and scripts/demo.sh for batch running.

The test_examples.py ensures they all still parse and execute cleanly.

Theme demo outputs are captured using shellplot (PNG for color fidelity; see Themes).

On this page