From 45438528761b0bbc143f8f2f013ee01917eb48cc Mon Sep 17 00:00:00 2001 From: Gaetan Semet Date: Tue, 10 Sep 2013 11:33:58 +0200 Subject: [PATCH] Completion for python, pep8, autopep8 and pylint Signed-off-by: Gaetan Semet --- plugins/autopep8/_autopep8 | 32 +++++++++++++++++ plugins/autopep8/autopep8.plugin.zsh | 0 plugins/pep8/_pep8 | 34 ++++++++++++++++++ plugins/pylint/_pylint | 31 ++++++++++++++++ plugins/pylint/pylint.plugin.zsh | 3 ++ plugins/python/_python | 54 ++++++++++++++++++++++++++++ plugins/python/python.plugin.zsh | 1 + 7 files changed, 155 insertions(+) create mode 100644 plugins/autopep8/_autopep8 create mode 100644 plugins/autopep8/autopep8.plugin.zsh create mode 100644 plugins/pep8/_pep8 create mode 100644 plugins/pylint/_pylint create mode 100644 plugins/pylint/pylint.plugin.zsh create mode 100644 plugins/python/_python diff --git a/plugins/autopep8/_autopep8 b/plugins/autopep8/_autopep8 new file mode 100644 index 000000000..c14d06d66 --- /dev/null +++ b/plugins/autopep8/_autopep8 @@ -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" diff --git a/plugins/autopep8/autopep8.plugin.zsh b/plugins/autopep8/autopep8.plugin.zsh new file mode 100644 index 000000000..e69de29bb diff --git a/plugins/pep8/_pep8 b/plugins/pep8/_pep8 new file mode 100644 index 000000000..ce19951dc --- /dev/null +++ b/plugins/pep8/_pep8 @@ -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|\]]::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" diff --git a/plugins/pylint/_pylint b/plugins/pylint/_pylint new file mode 100644 index 000000000..e466d051b --- /dev/null +++ b/plugins/pylint/_pylint @@ -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.]:::_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\]]::[,...]:_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.]:::_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.]:::_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.]:::_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).]:::_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).]:::_files" \ + "--output-format[Set the output format. Available formats are text, parseable, colorized, msvs (visual studio) and html \[current: text\]]:::_files" \ + "-f[Set the output format. Available formats are text, parseable, colorized, msvs (visual studio) and html \[current: text\]]:::_files" \ + "--include-ids[Include message's id in output \[current: no\]]:::_files" \ + "-i[Include message's id in output \[current: no\]]:::_files" \ + "--reports[Tells whether to display a full report or only the messages \[current: yes\]]:::_files" \ + "-r[Tells whether to display a full report or only the messages \[current: yes\]]:::_files" \ + "*::args:_files" diff --git a/plugins/pylint/pylint.plugin.zsh b/plugins/pylint/pylint.plugin.zsh new file mode 100644 index 000000000..6760c67b0 --- /dev/null +++ b/plugins/pylint/pylint.plugin.zsh @@ -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' \ No newline at end of file diff --git a/plugins/python/_python b/plugins/python/_python new file mode 100644 index 000000000..f517d4806 --- /dev/null +++ b/plugins/python/_python @@ -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 diff --git a/plugins/python/python.plugin.zsh b/plugins/python/python.plugin.zsh index 852c8b919..319bf0bf0 100644 --- a/plugins/python/python.plugin.zsh +++ b/plugins/python/python.plugin.zsh @@ -10,3 +10,4 @@ function pyclean() { # Grep among .py files alias pygrep='grep --include="*.py"' +