2003-02-27 06:12:25 +01:00
|
|
|
#compdef python
|
|
|
|
|
2004-12-06 13:50:59 +01:00
|
|
|
# Python 2.4
|
|
|
|
|
|
|
|
local curcontext="$curcontext" state line
|
|
|
|
typeset -A opt_args
|
|
|
|
|
2003-02-27 06:12:25 +01:00
|
|
|
_arguments -s -S \
|
|
|
|
'(1 -)-c+[program passed in as string (terminates option list)]:python command:' \
|
2004-01-21 14:53:28 +01:00
|
|
|
'-d[debug output from parser]' \
|
2003-02-27 06:12:25 +01:00
|
|
|
'-E[ignore environment variables (such as PYTHONPATH)]' \
|
2004-01-21 14:53:28 +01:00
|
|
|
'(1 * -)-h[display help information]' \
|
|
|
|
'-i[inspect interactively after running script]' \
|
2004-12-06 13:50:59 +01:00
|
|
|
'(1 * -)-m[run library module as a script (terminates option list)]:module:->modules' \
|
2004-01-21 14:53:28 +01:00
|
|
|
'-O[optimize generated bytecode]' \
|
2003-02-27 06:12:25 +01:00
|
|
|
'-OO[remove doc-strings in addition to the -O optimizations]' \
|
2004-01-21 14:53:28 +01:00
|
|
|
'-Q+[division options]:division option:(old warn warnall new)' \
|
2003-02-27 06:12:25 +01:00
|
|
|
"-S[don't imply 'import site' on initialization]" \
|
|
|
|
'-t[issue warnings about inconsistent tab usage]' \
|
|
|
|
'-tt[issue errors about inconsistent tab usage]' \
|
2004-01-21 14:53:28 +01:00
|
|
|
'-u[unbuffered binary stdout and stderr]' \
|
|
|
|
'-v[verbose (trace import statements)]' \
|
|
|
|
'(1 * -)-V[display version information]' \
|
|
|
|
'-W+[warning control]:warning filter (action:message:category:module:lineno):(default always ignore module once error)' \
|
2003-02-27 06:12:25 +01:00
|
|
|
'-x[skip first line of source, allowing use of non-Unix forms of #!cmd]' \
|
2004-01-21 14:53:28 +01:00
|
|
|
'(-)1:script file:_files -g "*.py(|c|o)(-.)"' \
|
2003-02-27 06:12:25 +01:00
|
|
|
'*:script argument:_files' && return
|
|
|
|
|
2004-12-06 13:50:59 +01:00
|
|
|
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
|
|
|
|
fi
|
|
|
|
|
2003-02-27 06:12:25 +01:00
|
|
|
return 1
|