ctil / zargparse

A tool for generating zsh completion files for python command line tools that use argparse
MIT License
11 stars 2 forks source link
argparse autocompletion oh-my-zsh python python3 zsh

Zargparse

Usage

Pass a python script to zargparse.py and it will write out a Zsh completion file to the current working directory. Make sure the script is executable under the current environment with Python 3 since zargparse needs to run the script.

./zargparse.py examples/future

It is recommended to use Pipenv to build a virtual environment.

pipenv install
pipenv run ./zargparse.py examples/future

Dependencies

Zargparse requires Python 3 and the Jinja2 library. It has been tested with Python 3.6.

Limitations

The tool does not support complex completions of arguments as described here. The completion file may need to be modified by hand after generation in order to fine tune the completions.

Nested sub-commands are not supported.

Positional arguments are not yet supported.