Skip to main content

Argcomplete support for python and xonsh scripts in xonsh shell.

If you like the idea click ⭐ on the repo and and tweet.

[Demo]
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_OK marker should be found in the first 10 lines of the file (example).
  • Additional .completer was set for add_argument (example).
  • argcomplete.autocomplete(parser) added before parser.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

Links

Metadata

Release files for xontrib-argcomplete 0.3.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xontrib-argcomplete 0.3.5
File Size Uploaded
xontrib_argcomplete-0.3.5.tar.gz 6.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xontrib-argcomplete 0.3.5
File Interpreter ABI Platform
xontrib_argcomplete-0.3.5-py3-none-any.whl Python 3 none any Details

Total release size: 11.6 kB

Release files / xontrib_argcomplete-0.3.5.tar.gz

Download URL xontrib_argcomplete-0.3.5.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
04d0d51776064b259665853b71a6dd5f5b2a94c47641aee193f00c18db0a1bc2
BLAKE2b-256 checksum
How to use checksums
a2171e34476c1ca8e61460dab44a396476b06f07f56b53d047d4507e7c980e8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release files / xontrib_argcomplete-0.3.5-py3-none-any.whl

Download URL xontrib_argcomplete-0.3.5-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d88b1f73061ab69c8d4b998967986e1d6939a4280188b580386100d7f59c941a
BLAKE2b-256 checksum
How to use checksums
3c405dac86edee7460e6bf4915b00688fd2f28f6be91e062a47f3a011f507500
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.4

Release history Release notifications | RSS feed

This release

0.3.5 This release

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.10

2 release files

0.2.9

2 release files

0.2.8

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page