Skip to main content

Automatic generated to zsh completion function, for Python's Option Parser Modules.

Project description

https://drone.io/bitbucket.org/hhatto/genzshcomp/status.png

Automatic generate to Zsh Completion Function from Python’s Option Parser Modules.

Now, It corresponds to argparse module and optparse module.

I write this module because I want to be created grin command’s Zsh Completion Function.

Installation

used to pip:

$ pip install genzshcomp

used to easy_install:

$ easy_install genzshcomp

Requirements

  • Python3.5+

Usage

show example dir…

from code of option parser object

basic usage:

## gen.py
from genzshcomp import CompletionGenerator
from optparse import OptionParser
parser = OptionParser()
generator = CompletionGenerator(command_name, parser)
print generator.get()

and zsh completion setups:

$ python gen.py > ~/.zsh/comp/_command
$ echo "fpath=(~/.zsh/comp/ $fpath)" >> ~/.zshrc
$ echo "autoload -U ~/.zsh/comp/*(:t)" >> ~/.zshrc
$ echo "autoload -Uz compinit" >> ~/.zshrc

from help-strings

basic usage and zsh completion setups (ex.pep8 command):

$ pep8 --help > pep8help.txt
$ genzshcomp pep8help.txt > ~/.zsh/comp/_pep8
$ echo "fpath=(~/.zsh/comp/ $fpath)" >> ~/.zshrc
$ echo "autoload -U ~/.zsh/comp/*(:t)" >> ~/.zshrc
$ echo "autoload -Uz compinit" >> ~/.zshrc

using shell pipe:

$ pep8 --help | genzshcomp > ~/.zsh/comp/_pep8
# As follows...

Support Bash Completion

using shell pipe:

$ pep8 --help | genzshcomp -f bash > /etc/bash_completion.d/pep8
$ bash

Support commands

and more…

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

genzshcomp-0.6.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

genzshcomp-0.6.0-py3.8.egg (11.7 kB view details)

Uploaded Source

File details

Details for the file genzshcomp-0.6.0.tar.gz.

File metadata

  • Download URL: genzshcomp-0.6.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.8

File hashes

Hashes for genzshcomp-0.6.0.tar.gz
Algorithm Hash digest
SHA256 b582910d36f9ad0992756d7e9ccbe3e5cf811934b1002b51f25b99d3dda9d573
MD5 b52b4882edb3327ac0d8e6478c754541
BLAKE2b-256 0b34e4129a3f898a35db4de999acf75371e79fe852d5581ecf57f288d9ac4fc6

See more details on using hashes here.

File details

Details for the file genzshcomp-0.6.0-py3.8.egg.

File metadata

  • Download URL: genzshcomp-0.6.0-py3.8.egg
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/3.8

File hashes

Hashes for genzshcomp-0.6.0-py3.8.egg
Algorithm Hash digest
SHA256 7f42c53c864f05b128ffca9d250e4fea34ff5876273a4ef838e152543a8483b4
MD5 0c8651fabbf0d1c653f53e7d0816ffb4
BLAKE2b-256 ff31f89662599f882e44f67fab2054eb6bb42011f97f1477d903f0d8e1e4af1a

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