Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: _rlogin splits up into three functions (still one file)



For consideration (i.e., not yet committed).  This makes it a little easier
to write a wrapper, e.g. Jay's Kerberized version could become

	#compdef krlogin krsh krcp
	compdef ${words[1]:t:s/k/_/} ${words[1]:t}
	_rlogin "$@"

Though of course that needs to become documented before he can rely on it.

Index: Completion/User/_rlogin
===================================================================
@@ -1,15 +1,18 @@
 #compdef rlogin rsh remsh rcp
 
+[[ $_comps[rsh] == _rlogin ]] && compdef _rsh rsh
+[[ $_comps[remsh] == _rlogin ]] && compdef _rsh remsh
+[[ $_comps[rcp] == _rlogin ]] && compdef _rcp rcp
+
 _rlogin () {
-  case "${words[1]:t}" in
-  rlogin)
     _arguments -s \
       '-8[allow 8-Bit data]' \
       '-e-[specify escape character]:escape character:' \
       '-l[specify login user name]:login as:_rlogin_users' \
       ':remote host name:_rlogin_hosts'
-    ;;
-  rsh|remsh)
+}
+
+_rsh() {
     local context state line ret=1
     typeset -A opt_args
 
@@ -26,8 +29,9 @@
       _normal && ret=0
     fi
     return ret
-    ;;
-  rcp)
+}
+
+_rcp () {
     local curcontext="$curcontext" state line ret=1 expl
     typeset -A opt_args
 
@@ -49,8 +53,6 @@
       fi
     fi
     return ret
-    ;;    
-  esac
 }
 
 _rlogin_users () {
@@ -71,4 +73,4 @@
   _tags hosts && _combination -s '[:@]' my-accounts users-hosts hosts "$@"
 }
 
-_rlogin "$@"
+$_comps[${words[1]:t}] "$@"

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



Messages sorted by: Reverse Date, Date, Thread, Author