mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-05 11:01:13 +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>
|
||||
|
||||
* 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;;
|
||||
-w) optarg=yes; shift;;
|
||||
-s) singopt=(-s); shift;;
|
||||
-W) alwopt=yes; shift;;
|
||||
-W) alwopt=arg; shift;;
|
||||
esac
|
||||
done
|
||||
|
||||
|
@ -282,7 +282,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
|
|||
eval ws\=\( "${action[3,-3]}" \)
|
||||
|
||||
_describe -t "$subc" "$descr" ws -M "$matcher" "$subopts[@]" ||
|
||||
alwopt=yes
|
||||
alwopt=${alwopt:-yes}
|
||||
tried=yes
|
||||
|
||||
elif [[ "$action" = \(*\) ]]; then
|
||||
|
@ -292,7 +292,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
|
|||
eval ws\=\( "${action[2,-2]}" \)
|
||||
|
||||
_all_labels "$subc" expl "$descr" compadd "$subopts[@]" -a - ws ||
|
||||
alwopt=yes
|
||||
alwopt=${alwopt:-yes}
|
||||
tried=yes
|
||||
elif [[ "$action" = \{*\} ]]; then
|
||||
|
||||
|
@ -301,7 +301,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
|
|||
while _next_label "$subc" expl "$descr"; do
|
||||
eval "$action[2,-2]" && ret=0
|
||||
done
|
||||
(( ret )) && alwopt=yes
|
||||
(( ret )) && alwopt=${alwopt:-yes}
|
||||
tried=yes
|
||||
elif [[ "$action" = \ * ]]; then
|
||||
|
||||
|
@ -311,7 +311,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
|
|||
while _next_label "$subc" expl "$descr"; do
|
||||
"$action[@]" && ret=0
|
||||
done
|
||||
(( ret )) && alwopt=yes
|
||||
(( ret )) && alwopt=${alwopt:-yes}
|
||||
tried=yes
|
||||
else
|
||||
|
||||
|
@ -321,7 +321,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
|
|||
while _next_label "$subc" expl "$descr"; do
|
||||
"$action[1]" "$subopts[@]" "$expl[@]" "${(@)action[2,-1]}" && ret=0
|
||||
done
|
||||
(( ret )) && alwopt=yes
|
||||
(( ret )) && alwopt=${alwopt:-yes}
|
||||
tried=yes
|
||||
fi
|
||||
fi
|
||||
|
@ -340,7 +340,8 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then
|
|||
PREFIX="$origpre"
|
||||
IPREFIX="$origipre"
|
||||
|
||||
if comparguments -s single; then
|
||||
if [[ -z "$alwopt" || -z "$tried" || "$alwopt" = arg ]] &&
|
||||
comparguments -s single; then
|
||||
|
||||
if [[ "$single" = direct ]]; then
|
||||
_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
|
||||
allow that if given the tt(-w) option.
|
||||
|
||||
Similarly, the option tt(-W) may be given to force completion of options
|
||||
even after options that get an argument in the same word. For example,
|
||||
if a command takes the options `tt(a)' and `tt(b)', where `tt(a)' needs
|
||||
an argument in the same word, directly after the option character,
|
||||
tt(_arguments) would normally only execute the action for that argument
|
||||
and not offer other options as possible completions. If given the
|
||||
tt(-W) option, it will offer other options as possible completions after
|
||||
executing the action for the argument. Note that, depending on the
|
||||
action, this may mean that the other options can't really be completed,
|
||||
but at least they will be listed. For more control, use an utility
|
||||
function like tt(_guard) in the argument's action.
|
||||
Similarly, the option tt(-W) may be given together with tt(-s) to force
|
||||
completion of single-letter options even after options that get an
|
||||
argument in the same word. For example, if a command takes the options
|
||||
`tt(a)' and `tt(b)', where `tt(a)' needs an argument in the same word,
|
||||
directly after the option character, tt(_arguments) would normally only
|
||||
execute the action for that argument and not offer other single-letter
|
||||
options as possible completions. If given the tt(-W) option, it will
|
||||
offer other options as possible completions after executing the action
|
||||
for the argument. Note that, depending on the action, this may mean
|
||||
that the other options can't really be completed, but at least they will
|
||||
be listed. For more control, use an utility function like tt(_guard) in
|
||||
the argument's action.
|
||||
|
||||
The forms of var(optspec) are:
|
||||
|
||||
|
|
Loading…
Reference in a new issue