mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-10 12:40:58 +02:00
14117
This commit is contained in:
parent
17539b1e2c
commit
b4b6d57e2c
3 changed files with 26 additions and 18 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2001-04-26 Sven Wischnowsky <wischnow@zsh.org>
|
||||||
|
|
||||||
|
* 14117: Completion/Base/Utility/_arguments, Doc/Zsh/compsys.yo:
|
||||||
|
tweak to make single-letter options only be completed after an
|
||||||
|
option with an argument if the -W option is given
|
||||||
|
|
||||||
2001-04-26 Bart Schaefer <schaefer@zsh.org>
|
2001-04-26 Bart Schaefer <schaefer@zsh.org>
|
||||||
|
|
||||||
* 14108: Src/Modules/termcap.c: Don't define USES_TERM* if the
|
* 14108: Src/Modules/termcap.c: Don't define USES_TERM* if the
|
||||||
|
|
|
@ -182,7 +182,7 @@ while [[ "$1" = -(O*|[CRWsw]) ]]; do
|
||||||
-R) rawret=yes; shift;;
|
-R) rawret=yes; shift;;
|
||||||
-w) optarg=yes; shift;;
|
-w) optarg=yes; shift;;
|
||||||
-s) singopt=(-s); shift;;
|
-s) singopt=(-s); shift;;
|
||||||
-W) alwopt=yes; shift;;
|
-W) alwopt=arg; shift;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -282,7 +282,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
|
||||||
eval ws\=\( "${action[3,-3]}" \)
|
eval ws\=\( "${action[3,-3]}" \)
|
||||||
|
|
||||||
_describe -t "$subc" "$descr" ws -M "$matcher" "$subopts[@]" ||
|
_describe -t "$subc" "$descr" ws -M "$matcher" "$subopts[@]" ||
|
||||||
alwopt=yes
|
alwopt=${alwopt:-yes}
|
||||||
tried=yes
|
tried=yes
|
||||||
|
|
||||||
elif [[ "$action" = \(*\) ]]; then
|
elif [[ "$action" = \(*\) ]]; then
|
||||||
|
@ -292,7 +292,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
|
||||||
eval ws\=\( "${action[2,-2]}" \)
|
eval ws\=\( "${action[2,-2]}" \)
|
||||||
|
|
||||||
_all_labels "$subc" expl "$descr" compadd "$subopts[@]" -a - ws ||
|
_all_labels "$subc" expl "$descr" compadd "$subopts[@]" -a - ws ||
|
||||||
alwopt=yes
|
alwopt=${alwopt:-yes}
|
||||||
tried=yes
|
tried=yes
|
||||||
elif [[ "$action" = \{*\} ]]; then
|
elif [[ "$action" = \{*\} ]]; then
|
||||||
|
|
||||||
|
@ -301,7 +301,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
|
||||||
while _next_label "$subc" expl "$descr"; do
|
while _next_label "$subc" expl "$descr"; do
|
||||||
eval "$action[2,-2]" && ret=0
|
eval "$action[2,-2]" && ret=0
|
||||||
done
|
done
|
||||||
(( ret )) && alwopt=yes
|
(( ret )) && alwopt=${alwopt:-yes}
|
||||||
tried=yes
|
tried=yes
|
||||||
elif [[ "$action" = \ * ]]; then
|
elif [[ "$action" = \ * ]]; then
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
|
||||||
while _next_label "$subc" expl "$descr"; do
|
while _next_label "$subc" expl "$descr"; do
|
||||||
"$action[@]" && ret=0
|
"$action[@]" && ret=0
|
||||||
done
|
done
|
||||||
(( ret )) && alwopt=yes
|
(( ret )) && alwopt=${alwopt:-yes}
|
||||||
tried=yes
|
tried=yes
|
||||||
else
|
else
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
|
||||||
while _next_label "$subc" expl "$descr"; do
|
while _next_label "$subc" expl "$descr"; do
|
||||||
"$action[1]" "$subopts[@]" "$expl[@]" "${(@)action[2,-1]}" && ret=0
|
"$action[1]" "$subopts[@]" "$expl[@]" "${(@)action[2,-1]}" && ret=0
|
||||||
done
|
done
|
||||||
(( ret )) && alwopt=yes
|
(( ret )) && alwopt=${alwopt:-yes}
|
||||||
tried=yes
|
tried=yes
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -340,7 +340,8 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
|
||||||
PREFIX="$origpre"
|
PREFIX="$origpre"
|
||||||
IPREFIX="$origipre"
|
IPREFIX="$origipre"
|
||||||
|
|
||||||
if comparguments -s single; then
|
if [[ -z "$alwopt" || -z "$tried" || "$alwopt" = arg ]] &&
|
||||||
|
comparguments -s single; then
|
||||||
|
|
||||||
if [[ "$single" = direct ]]; then
|
if [[ "$single" = direct ]]; then
|
||||||
_all_labels options expl option \
|
_all_labels options expl option \
|
||||||
|
|
|
@ -2938,17 +2938,18 @@ where `tt(a)' takes an argument in the next word, tt(_arguments) would
|
||||||
normally not complete the other option directly after `tt(-a)', but it would
|
normally not complete the other option directly after `tt(-a)', but it would
|
||||||
allow that if given the tt(-w) option.
|
allow that if given the tt(-w) option.
|
||||||
|
|
||||||
Similarly, the option tt(-W) may be given to force completion of options
|
Similarly, the option tt(-W) may be given together with tt(-s) to force
|
||||||
even after options that get an argument in the same word. For example,
|
completion of single-letter options even after options that get an
|
||||||
if a command takes the options `tt(a)' and `tt(b)', where `tt(a)' needs
|
argument in the same word. For example, if a command takes the options
|
||||||
an argument in the same word, directly after the option character,
|
`tt(a)' and `tt(b)', where `tt(a)' needs an argument in the same word,
|
||||||
tt(_arguments) would normally only execute the action for that argument
|
directly after the option character, tt(_arguments) would normally only
|
||||||
and not offer other options as possible completions. If given the
|
execute the action for that argument and not offer other single-letter
|
||||||
tt(-W) option, it will offer other options as possible completions after
|
options as possible completions. If given the tt(-W) option, it will
|
||||||
executing the action for the argument. Note that, depending on the
|
offer other options as possible completions after executing the action
|
||||||
action, this may mean that the other options can't really be completed,
|
for the argument. Note that, depending on the action, this may mean
|
||||||
but at least they will be listed. For more control, use an utility
|
that the other options can't really be completed, but at least they will
|
||||||
function like tt(_guard) in the argument's action.
|
be listed. For more control, use an utility function like tt(_guard) in
|
||||||
|
the argument's action.
|
||||||
|
|
||||||
The forms of var(optspec) are:
|
The forms of var(optspec) are:
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue