Skip to content

Code Generation

cli-to-py can generate standalone wrapper modules.

cli-to-py git -o git_wrapper.py

This writes:

  • git_wrapper.py
  • git_wrapper.pyi

Generated wrappers use only the Python standard library. They do not require cli-to-py at runtime.

import git_wrapper

result = git_wrapper.status(short=True)
result = await git_wrapper.status_async(short=True)

JSON and Stubs

cli-to-py git --json
cli-to-py git --stub
cli-to-py git --no-subcommands

--no-subcommands skips per-subcommand enrichment and is faster.

Static Snapshot

Generated wrappers are a snapshot of the CLI help output at generation time. Regenerate after upgrading the underlying CLI if you want updated flags or subcommands.