about summary refs log tree commit diff
path: root/Completion/Unix/Command/_screen
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2014-10-14 23:03:40 +0200
committerOliver Kiddle <opk@zsh.org>2014-10-14 23:04:45 +0200
commit13fc579343b24d298fb8905933b6000d7fcda114 (patch)
treecbc1000696357438714107635f93166bcab76d3a /Completion/Unix/Command/_screen
parent66320ca93a717467a0ed0d34da4c06257953aa50 (diff)
downloadzsh-13fc579343b24d298fb8905933b6000d7fcda114.tar.gz
zsh-13fc579343b24d298fb8905933b6000d7fcda114.tar.xz
zsh-13fc579343b24d298fb8905933b6000d7fcda114.zip
33467: correct return status on functions and numerous other minor fixes
Diffstat (limited to 'Completion/Unix/Command/_screen')
-rw-r--r--Completion/Unix/Command/_screen31
1 files changed, 16 insertions, 15 deletions
diff --git a/Completion/Unix/Command/_screen b/Completion/Unix/Command/_screen
index 931946c78..510fd7195 100644
--- a/Completion/Unix/Command/_screen
+++ b/Completion/Unix/Command/_screen
@@ -1,20 +1,8 @@
 #compdef screen
 
-local curcontext="$curcontext" state line expl
+local curcontext="$curcontext" state line expl ret=1
 local scr_cmds sessions
 
-function __screen_normal() {
-    if (( CURRENT == 1 )) && [[ $PREFIX == /dev/* ]]; then
-        _path_files -g '*(%)'
-    elif (( CURRENT == 2 )) && [[ ${words[1]} == /dev/* ]]; then
-        _message "baud rate"
-    elif (( CURRENT > 2 )) && [[ ${words[1]} == /dev/* ]]; then
-        _message "no more parameters"
-    else
-        _normal "$@"
-    fi
-}
-
 scr_cmds=(
   acladd            aclchg            acldel            aclgrp
   aclumask          activity          addacl            allpartial
@@ -103,10 +91,21 @@ _arguments -C \
   '-Dx: :->any-sessions' \
   '-dx: :->any-sessions' \
   '-X[execute command as a screen command in the specified session]:screencmd:(${scr_cmds[@]})' \
-  '*::arguments: __screen_normal'
+  '*:: :->normal' && ret=0
 
 if [[ -n $state ]]; then
   case $state in
+    normal)
+      if (( CURRENT == 1 )) && [[ $PREFIX == /dev/* ]]; then
+	  _path_files -g '*(%)'
+      elif (( CURRENT == 2 )) && [[ ${words[1]} == /dev/* ]]; then
+	  _message "baud rate"
+      elif (( CURRENT > 2 )) && [[ ${words[1]} == /dev/* ]]; then
+	  _message "no more parameters"
+      else
+	  _normal
+      fi
+    ;;
     attached-sessions)
       sessions=(
         ${${${(M)${(f)"$(_call_program screen-sessions $words[1] \
@@ -134,4 +133,6 @@ if [[ -n $state ]]; then
     _wanted screen-sessions expl "${state%-*} screen process" \
 	compadd ${sessions#*.}
   fi
-fi
+fi && ret=0
+
+return ret