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.9.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a818afa5b60246a458c3d4ec819a3970bde4886f87fea0519559155d4031a7ea |
|
MD5 | 70c57303243374f8188c938d2c52d54c |
|
BLAKE2b-256 | caafc030b61e45271f512c4095a0ed962c681944708b0047ca26ee995f191fe2 |
Hashes for xontrib_argcomplete-0.2.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c1972c1a77edc80bfebd9a0a4addacff9bf1b078ef41a255ed96ccbab92adfb |
|
MD5 | ff1455cb5202dcc9a80fc54f2f4961d5 |
|
BLAKE2b-256 | deabb3c3a1e250ff5771d480afbf5b6baf57fb2551adfade3b57b618ea39e9a3 |