From 9f9b6e165516c4ee59b1f5b609a6890ccc3d598f Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Fri, 5 May 2000 13:38:45 +0000 Subject: completion function cleanup for `_arguments' with the `-C' option and using it's return value (11195) --- Completion/User/_socket | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'Completion/User/_socket') diff --git a/Completion/User/_socket b/Completion/User/_socket index 788113c28..9db31c9ae 100644 --- a/Completion/User/_socket +++ b/Completion/User/_socket @@ -5,7 +5,7 @@ # hosts-ports # The style that contains pairs `host:port'. -local curcontext="$curcontext" state line expl +local curcontext="$curcontext" state line expl ret=1 typeset -A opt_args [[ $CURRENT -eq 2 ]] && @@ -25,30 +25,32 @@ _arguments -C -s \ '-l[loop]' \ '-p[program]:command:->command' \ ':arg1:->arg1' \ - ':arg2:->arg2' + ':arg2:->arg2' && ret=0 case "$state" in command) compset -q if [[ $CURRENT -eq 1 ]]; then - _command_names -e "$@" + _command_names -e "$@" && ret=0 else - _normal + _normal && ret=0 fi ;; arg1) if (( $+opt_args[-s] )); then - _ports + _ports && ret=0 else - _wanted hosts expl 'host' _combination '' hosts-ports hosts - + _wanted hosts expl 'host' _combination '' hosts-ports hosts - && ret=0 fi ;; arg2) if (( ! $+opt_args[-s] )); then _wanted ports expl 'port to connect' \ - _combination '' hosts-ports hosts="${line[1]:q}" ports - + _combination '' hosts-ports hosts="${line[1]:q}" ports - && ret=0 fi ;; esac + +return ret -- cgit 1.4.1