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 stay tuned by watching releases.
Screenshot made with xontrib-prompt-bar and Konsole.
Install
xpip install xontrib-argcomplete
echo 'xontrib load argcomplete' >> ~/.xonshrc
# Reload xonsh
Usage
Before usage you must add the argcomplete support to your script. The PYTHON_ARGCOMPLETE_OK
marker should be found in the first 10 lines of the file.
The argcomplete xonsh completer will be activated with this cases:
python script.py
./script.py
./path/script.py
xonsh script.xsh
./script.xsh
./path/script.xsh
# scripts without extension should have "env python" or "env xonsh" or path to python/xonsh in the shebang
./script
script # script should be found in $PATH
Example
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
Known issues
Current version supports Linux/Mac only.
Files or paths with spaces in names is not supported now and completion will not be activated. To solve this we should use __xonsh__.execer.parser.lexer.split(line)
instead of regexp. PRs are welcome!
Development
- To switch on the debug mode run
$XONTRIB_ARGCOMPLETE_DEBUG = True
. - Argcomplete environment variables
- Argcomplete documentation
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
Hashes for xontrib-argcomplete-0.2.10.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 80e767e1345468135f1929979c2b4d276e055025013589a32672693f1ce29a89 |
|
MD5 | 188b6da50ae0b1d40347270be79339ae |
|
BLAKE2b-256 | 664f781a6dcbc061782c55ba560c30d53b0f7dd5292f62272475c8a81ab4387d |
Hashes for xontrib_argcomplete-0.2.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2aee5af1e9d269ef60f16959f3bdf8a9219d81d2e5ba57eeba8119e12f2c1575 |
|
MD5 | 0a4979b8d313e951df3cef627ec66cff |
|
BLAKE2b-256 | 7f035335fcabcb2e94d5548cd16b6f988abb2c4dc7de35a070147715ec36e082 |