Completion for python, pep8, autopep8 and pylint

Signed-off-by: Gaetan Semet <gaetan@xeberon.net>
This commit is contained in:
Gaetan Semet 2013-09-10 11:33:58 +02:00
parent d3e005d6b4
commit 4543852876
7 changed files with 155 additions and 0 deletions

View File

@ -0,0 +1,32 @@
#compdef autopep8
#
# this is zsh completion function file.
# generated by genzshcomp(ver: 0.5.1)
#
typeset -A opt_args
local context state line
_arguments -s -S \
"--help[show this help message and exit]:" \
"-h[show this help message and exit]:" \
"--version[show program's version number and exit]:" \
"--verbose[print verbose messages; multiple -v result in more verbose messages]" \
"-v[print verbose messages; multiple -v result in more verbose messages]" \
"--diff[print the diff for the fixed source]" \
"-d[print the diff for the fixed source]" \
"--in-place[make changes to files in place]" \
"-i[make changes to files in place]" \
"--recursive[run recursively; must be used with --in-place or --diff]" \
"-r[run recursively; must be used with --in-place or --diff]" \
"--jobs[number of parallel jobs; match CPU count if value is less than 1]::n number of parallel jobs; match CPU count if value is:_files" \
"-j[number of parallel jobs; match CPU count if value is less than 1]::n number of parallel jobs; match CPU count if value is:_files" \
"--pep8-passes[maximum number of additional pep8 passes (default: 100)]::n:_files" \
"-p[maximum number of additional pep8 passes (default: 100)]::n:_files" \
"-a[-a result in more aggressive changes]::result:_files" \
"--exclude[exclude files/directories that match these comma- separated globs]::globs:_files" \
"--list-fixes[list codes for fixes; used by --ignore and --select]" \
"--ignore[do not fix these errors/warnings (default E226,E24)]::errors:_files" \
"--select[fix only these errors/warnings (e.g. E4,W)]::errors:_files" \
"--max-line-length[set maximum allowed line length (default: 79)]::n:_files" \
"*::args:_files"

View File

34
plugins/pep8/_pep8 Normal file
View File

@ -0,0 +1,34 @@
#compdef pep8
#
# this is zsh completion function file.
# generated by genzshcomp(ver: 0.5.1)
#
typeset -A opt_args
local context state line
_arguments -s -S \
"--help[show this help message and exit]:" \
"-h[show this help message and exit]:" \
"--version[show program's version number and exit]:" \
"--verbose[print status messages, or debug with -vv]" \
"-v[print status messages, or debug with -vv]" \
"--quiet[report only file names, or nothing with -qq]" \
"-q[report only file names, or nothing with -qq]" \
"--repeat[(obsolete) show all occurrences of the same error]" \
"-r[(obsolete) show all occurrences of the same error]" \
"--first[show first occurrence of each error]" \
"--exclude[exclude files or directories which match these comma separated patterns (default: .svn,CVS,.bzr,.hg,.git,__pycache__)]::patterns:_files" \
"--filename[when parsing directories, only check filenames matching these comma separated patterns (default: *.py)]::patterns:_files" \
"--select[select errors and warnings (e.g. E,W6)]::errors:_files" \
"--ignore[skip errors and warnings (e.g. E4,W)]::errors:_files" \
"--show-source[show source code for each error]" \
"--show-pep8[show text of PEP 8 for each error (implies --first)]" \
"--statistics[count errors and warnings]" \
"--count[print total number of errors and warnings to standard error and set exit code to 1 if total is not null]" \
"--max-line-length[set maximum allowed line length (default: 79)]::n:_files" \
"--format[set the error format \[default|pylint|<custom>\]]::format:_files" \
"--diff[report only lines changed according to the unified diff received on STDIN]" \
"--benchmark[measure processing speed are read from the \[pep8\] section of the tox.ini fg file located in any parent folder of the path(s) llowed options are: exclude, filename, select, ngth, count, format, quiet, show-pep8, show-source, .]" \
"--config[user config file location (default: /home/gsemet/.config/pep8)]::path:_files" \
"*::args:_files"

31
plugins/pylint/_pylint Normal file
View File

@ -0,0 +1,31 @@
#compdef pylint
#
# this is zsh completion function file.
# generated by genzshcomp(ver: 0.5.1)
#
typeset -A opt_args
local context state line
_arguments -s -S \
"--help[show this help message and exit]:" \
"-h[show this help message and exit]:" \
"--version[show program's version number and exit]:" \
"--long-help[more verbose help.]" \
"--rcfile[Specify a configuration file.]::<file>:_files" \
"--errors-only[In error mode, checkers without error messages are disabled and for others, only the ERROR messages are displayed, and no reports are done by default]" \
"-E[In error mode, checkers without error messages are disabled and for others, only the ERROR messages are displayed, and no reports are done by default]" \
"--ignore[Add files or directories to the blacklist. They should be base names, not paths. \[current: CVS\]]::<file>[,<file>...]:_files" \
"--help-msg[Display a help message for the given message id and exit. The value may be a comma separated list of message ids.]::<msg-id>:_files" \
"--generate-rcfile[Generate a sample configuration file according to the current configuration. You can put other options before this one to get them in the generated configuration.]" \
"--enable[Enable the message, report, category or checker with the given id(s). You can either give multiple identifier separated by comma (,) or put this option multiple time.]::<msg ids>:_files" \
"-e[Enable the message, report, category or checker with the given id(s). You can either give multiple identifier separated by comma (,) or put this option multiple time.]::<msg ids>:_files" \
"--disable[Disable the message, report, category or checker with the given id(s). You can either give multiple identifier separated by comma (,) or put this option multiple time (only on the command line, not in the configuration file where it should appear only once).]::<msg ids>:_files" \
"-d[Disable the message, report, category or checker with the given id(s). You can either give multiple identifier separated by comma (,) or put this option multiple time (only on the command line, not in the configuration file where it should appear only once).]::<msg ids>:_files" \
"--output-format[Set the output format. Available formats are text, parseable, colorized, msvs (visual studio) and html \[current: text\]]::<format>:_files" \
"-f[Set the output format. Available formats are text, parseable, colorized, msvs (visual studio) and html \[current: text\]]::<format>:_files" \
"--include-ids[Include message's id in output \[current: no\]]::<y_or_n>:_files" \
"-i[Include message's id in output \[current: no\]]::<y_or_n>:_files" \
"--reports[Tells whether to display a full report or only the messages \[current: yes\]]::<y_or_n>:_files" \
"-r[Tells whether to display a full report or only the messages \[current: yes\]]::<y_or_n>:_files" \
"*::args:_files"

View File

@ -0,0 +1,3 @@
# Aliases
alias pylint-quick='pylint --reports=n --include-ids=y'
compdef _pylint-quick pylint-quick='pylint --reports=n --include-ids=y'

54
plugins/python/_python Normal file
View File

@ -0,0 +1,54 @@
#compdef python
# Python 2.6
# Python 3.0
local curcontext="$curcontext" state line expl
typeset -A opt_args
local -a args
if _pick_variant python3=Python\ 3 python2 --version; then
args=(
'(-bb)-b[issue warnings about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]'
'(-b)-bb[issue errors about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]'
)
else
args=(
'-Q+[division options]:division option:(old warn warnall new)'
'(-tt)-t[issue warnings about inconsistent tab usage]'
'(-t)-tt[issue errors about inconsistent tab usage]'
'-3[warn about Python 3.x incompatibilities]'
)
fi
_arguments -C -s -S "$args[@]" \
"-B[don't write .py\[co\] files on import]" \
'(1 -)-c+[program passed in as string (terminates option list)]:python command:' \
'-d[debug output from parser]' \
'-E[ignore PYTHON* environment variables (such as PYTHONPATH)]' \
'(1 * -)-h[display help information]' \
'-i[inspect interactively after running script]' \
'(1 * -)-m[run library module as a script (terminates option list)]:module:->modules' \
'-O[optimize generated bytecode slightly]' \
'-OO[remove doc-strings in addition to the -O optimizations]' \
"-s[don't add user site directory to sys.path]" \
"-S[don't imply 'import site' on initialization]" \
'-u[unbuffered binary stdout and stderr]' \
'-v[verbose (trace import statements)]' \
'(1 * -)'{-V,--version}'[display version information]' \
'-W+[warning control]:warning filter (action\:message\:category\:module\:lineno):(default always ignore module once error)' \
'-x[skip first line of source, allowing use of non-Unix forms of #!cmd]' \
'(-)1:script file:_files -g "*.py(|c|o)(-.)"' \
'*::script argument: _normal' && return
if [[ "$state" = modules ]]; then
local -a modules
modules=(
${${=${(f)"$(_call_program modules $words[1] -c \
'from\ pydoc\ import\ help\;\ help\(\"modules\"\)')"}[2,-3]}:#\(package\)}
)
_wanted modules expl module compadd -a modules && return
fi
return 1

View File

@ -10,3 +10,4 @@ function pyclean() {
# Grep among .py files # Grep among .py files
alias pygrep='grep --include="*.py"' alias pygrep='grep --include="*.py"'