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

Known issues

This is the alpha version of the xontrib-argcomplete and the proof of concept. It was tested on stack with Ubuntu, xonsh, conda. Help to improve it by opening a detailed issues and making pull requests. Thanks!

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.2.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

xontrib_argcomplete-0.0.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file xontrib-argcomplete-0.0.2.tar.gz.

File metadata

  • Download URL: xontrib-argcomplete-0.0.2.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for xontrib-argcomplete-0.0.2.tar.gz
Algorithm Hash digest
SHA256 24c165c1dfd5a8085770af2e2c0694e053c66ece8c41aa12aa669b6d7beb5de6
MD5 93d799a150451ec6a6941d90f56409d2
BLAKE2b-256 dd114e0c6e416ce90d69c09da3e2266bf84adebf7e766c63412e16f57dae7c45

See more details on using hashes here.

File details

Details for the file xontrib_argcomplete-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: xontrib_argcomplete-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.5

File hashes

Hashes for xontrib_argcomplete-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 efc1f8f5bdcc61e899ef9da65fbdbbcac89dba87da7680c6eeb46be274f96ada
MD5 ba7d544ab56af930e26530b786b01665
BLAKE2b-256 d9da32672cb122a00b487d5e68ddc7c0aba82b9697946bc15b3462b0c52d4174

See more details on using hashes here.

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