Argcomplete support for python and xonsh scripts in xonsh shell.
If you like the idea click ⭐ on the repo and and tweet.
![[Demo]](https://raw.githubusercontent.com/anki-code/xontrib-argcomplete/master/static/xontrib-argcomplete-demo.png)
Screenshot made with xontrib-prompt-bar and Konsole.
xpip install xontrib-argcomplete
echo 'xontrib load argcomplete' >> ~/.xonshrc
# Reload xonshFirst of all you need to add the argcomplete support to your script:
- The
PYTHON_ARGCOMPLETE_OKmarker should be found in the first 10 lines of the file (example). - Additional
.completerwas set foradd_argument(example). argcomplete.autocomplete(parser)added beforeparser.parse_args()(example).
Example for proto.py sample:
xpip install xontrib-argcomplete
xontrib load argcomplete
cd /tmp && git clone https://github.com/anki-code/xontrib-argcomplete
cd xontrib-argcomplete/tests
python proto.py <Tab> # Suggestions: --help --proto -h
./proto.py --proto tt<Tab> # Suggestions: http https
./proto.xsh --proto tt<Tab> # Suggestions: http https
./proto --proto tt<Tab> # Suggestions: http https
$PATH.append($PWD)
proto --proto tt<Tab> # Suggestions: http httpsThe argcomplete xonsh completer will be activated with this cases:
python script.py <Tab>
./script.py <Tab>
./path/script.py <Tab>
xonsh script.xsh <Tab>
./script.xsh <Tab>
./path/script.xsh <Tab>
# scripts without extension should have "env python" or "env xonsh" or path to python/xonsh in the shebang
./script <Tab>
script <Tab> # script should be found in $PATHWindows is not supported. PRs are welcome!
- To switch on the debug mode run
$XONTRIB_ARGCOMPLETE_DEBUG = True. - Argcomplete environment variables
- Argcomplete documentation
- This package is the part of ergopack - the pack of ergonomic xontribs.
- This package was created with xontrib cookiecutter template.