summary refs log tree commit diff
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 12:01:21 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-04-02 12:01:21 +0000
commit66752b355dee1695035360cb6e347aec2080fad4 (patch)
treec71727cdc53ff49c4b8d6c22c20554a96821a628 /Completion/Unix/Command
parent1ba8e89a9ed851a1b0f2d324c8fb07767adbd81e (diff)
downloadzsh-66752b355dee1695035360cb6e347aec2080fad4.tar.gz
zsh-66752b355dee1695035360cb6e347aec2080fad4.tar.xz
zsh-66752b355dee1695035360cb6e347aec2080fad4.zip
moved from Completion/User/_rlogin
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r--Completion/Unix/Command/_rlogin74
1 files changed, 74 insertions, 0 deletions
diff --git a/Completion/Unix/Command/_rlogin b/Completion/Unix/Command/_rlogin
new file mode 100644
index 000000000..bdfe2b44c
--- /dev/null
+++ b/Completion/Unix/Command/_rlogin
@@ -0,0 +1,74 @@
+#compdef rlogin rsh remsh=rsh rcp
+
+_rlogin () {
+  case "$service" 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)
+    local context state line ret=1
+    typeset -A opt_args
+
+    _arguments -s \
+      '-n[ignore stdin]' \
+      '-l[specify login user name]:login as:_rlogin_users' \
+      ':remote host name:_rlogin_hosts' \
+      '(-):command: _command_names -e' \
+      '*::command:->command' && ret=0
+
+    if [[ -n "$state" ]]; then
+      shift 1 words
+      (( CURRENT-- ))
+      _normal && ret=0
+    fi
+    return ret
+    ;;
+  rcp)
+    local curcontext="$curcontext" state line ret=1 expl
+    typeset -A opt_args
+
+    _arguments -C -s \
+      '-p[preserve modification times]' \
+      '-r[recursively copy directories]' \
+      '*:files:->files' && ret=0
+
+    if [[ -n "$state" ]]; then
+      if compset -P '*:'; then
+	_files && ret=0
+      elif compset -P '*@'; then
+        _wanted hosts expl host _rlogin_hosts -S: && ret=0
+      else
+        _alternative \
+	    'files:: _files' \
+	    'hosts:: _rlogin_all_hosts -S:' \
+	    'users:: _rlogin_users -qS@' && ret=0
+      fi
+    fi
+    return ret
+    ;;    
+  esac
+}
+
+_rlogin_users () {
+  _tags users && _combination -s '[:@]' my-accounts users-hosts users "$@"
+}
+
+_rlogin_hosts () {
+  _tags hosts &&
+      if [[ "$IPREFIX" == *@ ]]; then
+        _combination -s '[:@]' my-accounts users-hosts "users=${IPREFIX/@}" hosts "$@"
+      else
+        _combination -s '[:@]' my-accounts users-hosts \
+            ${opt_args[-l]:+"users=${opt_args[-l]:q}"} hosts "$@"
+      fi
+}
+
+_rlogin_all_hosts () {
+  _tags hosts && _combination -s '[:@]' my-accounts users-hosts hosts "$@"
+}
+
+_rlogin "$@"