summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_python
diff options
context:
space:
mode:
authorOliver Kiddle <okiddle@yahoo.co.uk>2014-07-17 16:58:23 +0200
committerOliver Kiddle <okiddle@yahoo.co.uk>2014-07-17 16:58:23 +0200
commitfbcf719e28481142434822b1270c8bb9807fb6a0 (patch)
treedde0b2f95b936df01a181974ff4387be3ccf8d24 /Completion/Unix/Command/_python
parent4e54648add79f7cb0c0fe81e46f49817d4555f2a (diff)
downloadzsh-fbcf719e28481142434822b1270c8bb9807fb6a0.tar.gz
zsh-fbcf719e28481142434822b1270c8bb9807fb6a0.zip
32848: fix words array before using _normal for script arguments
Diffstat (limited to 'Completion/Unix/Command/_python')
-rw-r--r--Completion/Unix/Command/_python27
1 files changed, 14 insertions, 13 deletions
diff --git a/Completion/Unix/Command/_python b/Completion/Unix/Command/_python
index da84b30b5..8e32bdf55 100644
--- a/Completion/Unix/Command/_python
+++ b/Completion/Unix/Command/_python
@@ -1,7 +1,7 @@
#compdef python python2 python2.4 python2.5 python2.6 python2.7 python3.0 python3.1 python3.2 python3.3 python3.4
-# Python 2.6
-# Python 3.0
+# Python 2.7
+# Python 3.4
local curcontext="$curcontext" state line expl
typeset -A opt_args
@@ -12,9 +12,12 @@ 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]'
+ "-I[isolate Python from the user's environment]"
+ '-X[set implementation-specific option]:option'
)
else
args=(
+ '-R[use a pseudo-random salt to make hash values unpredeictable]'
'-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]'
@@ -24,12 +27,12 @@ fi
_arguments -C -s -S "$args[@]" \
"-B[don't write .py\[co\] files on import]" \
- '(-)-c+[program passed in as string (terminates option list)]:python command:' \
+ '(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]' \
- '(-)-m[run library module as a script (terminates option list)]:module:->modules' \
+ '(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]" \
@@ -39,8 +42,8 @@ _arguments -C -s -S "$args[@]" \
'(1 * -)-V[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_or_arg:->script_or_arg' \
- '*::script argument: _normal' && return
+ '(-)1:Python script:_files -g "*.py(|c|o)(-.)"' \
+ '*::script argument:= ->normal' && return
case "$state" in
modules)
@@ -51,14 +54,12 @@ case "$state" in
)
_wanted modules expl module compadd -a modules && return
;;
- script_or_arg)
- if [[ -n "$opt_args[(I)-(c|m)]" ]]; then
- _description arg expl 'file'
- _files "$expl[@]" && return
- else
- _description script expl 'Python script'
- _files "$expl[@]" -g "*.py(|c|o)(-.)" && return
+ normal)
+ if [[ -z "$opt_args[(I)-(c|m)]" ]]; then
+ shift words
+ (( CURRENT-- ))
fi
+ _normal && return
;;
esac