From a2750a4effef1db7966530cd39905dbb7cf2b99c Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Mon, 29 May 2000 08:00:46 +0000 Subject: fixes for _arguments with sets; make _zpty not use sets (11624) --- Completion/Base/_arguments | 6 +++--- Completion/Builtins/_zpty | 53 ++++++++++++++++++++++++++++++++++------------ 2 files changed, 42 insertions(+), 17 deletions(-) (limited to 'Completion') diff --git a/Completion/Base/_arguments b/Completion/Base/_arguments index 11c62705f..44895d9d3 100644 --- a/Completion/Base/_arguments +++ b/Completion/Base/_arguments @@ -293,9 +293,9 @@ if (( $# )) && comparguments -i "$autod" "$@"; then fi fi fi - shift "${#descrs} ? 1 : 0" descrs - shift "${#actions} ? 1 : 0" actions - shift "${#subcs} ? 1 : 0" subcs + shift descrs + shift actions + shift subcs done if [[ -z "$matched$hasopts" ]] && _requested options && diff --git a/Completion/Builtins/_zpty b/Completion/Builtins/_zpty index de793c814..dd551ab97 100644 --- a/Completion/Builtins/_zpty +++ b/Completion/Builtins/_zpty @@ -3,19 +3,42 @@ local state line list names expl curcontext="$curcontext" typeset -A opt_args + _arguments -C -s \ - '(-r)*::args:_normal' \ - - eb \ - '-e[echo input characters]' \ - '-b[io to pseudo-terminal blocking]' \ - - d \ - '-d[delete command]:*:name:->name' \ - - w \ - '-w[send string to command]:name:->name:*:strings to write' \ - - L \ - '-L[list defined commands as calls]' \ - - r \ - '(*)-r[read string from command]:name:->name:param:_parameters' && return 0 + '(-r -w -L -d)-e[echo input characters]' \ + '(-r -w -L -d)-b[io to pseudo-terminal blocking]' \ + '(-r -w -L -e -b)-d[delete command]:*:name:->name' \ + '(-r -L -e -b -d)-w[send string to command]:name:->name:*:strings to write' \ + '(: -r -w -e -b -d)-L[list defined commands as calls]' \ + '(: -w -L -e -b -d)-r[read string from command]:name:->name:param: _parameters:pattern:' \ + '(-r -w -L -d):zpty command name:' \ + '(-r -w -L -d):cmd: _command_names -e' \ + '(-r -w -L -d)*::args:_precommand' && return 0 + +# One could use sets, but that's more expensive and zpty is simple enough. +# +# _arguments -C -s \ +# - read \ +# '-r[read string from command]' \ +# ':name:->name' \ +# ':param: _parameters' \ +# ':pattern:' \ +# - write \ +# '-w[send string to command]' \ +# ':name:->name' \ +# '*:strings to write' \ +# - list \ +# '-L[list defined commands as calls]' \ +# - delete \ +# '-d[delete command]' \ +# '*:name:->name' \ +# - start \ +# '-e[echo input characters]' \ +# '-b[io to pseudo-terminal blocking]' \ +# ':zpty command name:' \ +# ':cmd: _command_names -e' \ +# '*::args:_precommand' && return 0 + if [[ $state = name ]]; then if ! zmodload -e zsh/zpty; then @@ -26,8 +49,10 @@ if [[ $state = name ]]; then names=( ${list%%:*} ) if zstyle -T ":completion:${curcontext}" verbose; then zformat -a list ' --' ${${(f)"$(zpty)"}#*\) } - _wanted names expl 'zpty command names' compadd -d list - "$names[@]" + _wanted names expl 'zpty command name' compadd -d list - "$names[@]" else - _wanted names expl 'zpty command names' compadd - "$names[@]" + _wanted names expl 'zpty command name' compadd - "$names[@]" fi +else + return 1 fi -- cgit 1.4.1