Skip to main content

Adding support of kislyuk/argcomplete to xonsh.

Project description

Adding support of kislyuk/argcomplete to xonsh.

If you like the idea of xontrib-argcomplete click ⭐ on the repo and stay tuned by watching releases.

Install

xpip install -U xontrib-argcomplete
echo 'xontrib load argcomplete' >> ~/.xonshrc
# Reload xonsh

Usage

Current version of completion is working only for commands that starts with:

  • python <path/to/python_script.py> ...
  • <path/to/python_script.py> ...

For example create proto.py with the content:

#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
import argparse, argcomplete
from argcomplete.completers import ChoicesCompleter

parser = argparse.ArgumentParser()
parser.add_argument("--proto").completer=ChoicesCompleter(('http', 'https', 'ssh', 'rsync', 'wss'))
argcomplete.autocomplete(parser)
args = parser.parse_args()
print('ok')

Then try completion:

python proto.py <Tab>
# Suggestions: --help --proto -h

chmod +x proto.py
./proto.py --proto tt<Tab>
# Suggestions: http https

The xontrib was tested on Ubuntu+Conda+Xonsh and on Mac+Brew+PyPi+Xonsh.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xontrib-argcomplete-0.0.5.tar.gz (2.9 kB view hashes)

Uploaded Source

Built Distribution

xontrib_argcomplete-0.0.5-py3-none-any.whl (3.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page