自动生成到zsh完成函数,用于python的option解析器模块。
genzshcomp的Python项目详细描述
安装
用于pip:
$ pip install genzshcomp
用于轻松安装:
$ easy_install genzshcomp
要求
- Python2.6+
用法
显示示例目录…
从选项解析器对象的代码
基本用法:
## gen.py from genzshcomp import CompletionGenerator from optparse import OptionParser parser = OptionParser() generator = CompletionGenerator(command_name, parser) print generator.get()
以及zsh完成设置:
$ python gen.py > ~/.zsh/comp/_command $ echo "fpath=(~/.zsh/comp/ $fpath)" >> ~/.zshrc $ echo "autoload -U ~/.zsh/comp/*(:t)" >> ~/.zshrc $ echo "autoload -Uz compinit" >> ~/.zshrc
从帮助字符串
基本用法和zsh完成设置(例如pep8命令):
$ 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
使用壳管:
$ pep8 --help | genzshcomp > ~/.zsh/comp/_pep8 # As follows...
支持bash完成
使用壳管:
$ pep8 --help | genzshcomp -f bash > /etc/bash_completion.d/pep8 $ bash
支持命令
- grin/grind(grin–帮助)
- gunicorn(gunicorn–帮助)
- markdown2(markdown2–帮助)
- paver(paver–帮助)
- pep8(pep8–帮助)
- pylint(pylint–长帮助)
还有更多…