Argcomplete support for python and xonsh scripts in xonsh shell.
Project description
Argcomplete support for python and xonsh scripts in xonsh shell.
If you like the idea click ⭐ on the repo and and tweet.
Screenshot made with xontrib-prompt-bar and Konsole.
Install
xpip install xontrib-argcomplete
echo 'xontrib load argcomplete' >> ~/.xonshrc
# Reload xonsh
Usage
First 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 https
The 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 $PATH
Known issues
Windows is not supported. PRs are welcome!
Development
- To switch on the debug mode run
$XONTRIB_ARGCOMPLETE_DEBUG = True. - Argcomplete environment variables
- Argcomplete documentation
Links
- This package is the part of ergopack - the pack of ergonomic xontribs.
- This package was created with xontrib cookiecutter template.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xontrib_argcomplete-0.3.5.tar.gz.
File metadata
- Download URL: xontrib_argcomplete-0.3.5.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04d0d51776064b259665853b71a6dd5f5b2a94c47641aee193f00c18db0a1bc2
|
|
| MD5 |
9aa5a73a806cf3b2a0db2c222bc01689
|
|
| BLAKE2b-256 |
a2171e34476c1ca8e61460dab44a396476b06f07f56b53d047d4507e7c980e8f
|
File details
Details for the file xontrib_argcomplete-0.3.5-py3-none-any.whl.
File metadata
- Download URL: xontrib_argcomplete-0.3.5-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d88b1f73061ab69c8d4b998967986e1d6939a4280188b580386100d7f59c941a
|
|
| MD5 |
c89aef551b3bd6b5e9777b25c17f3221
|
|
| BLAKE2b-256 |
3c405dac86edee7460e6bf4915b00688fd2f28f6be91e062a47f3a011f507500
|