diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-04-05 11:28:08 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-04-05 11:28:08 +0000 |
commit | b8bdb144d2a310632efb3bbd7dd78d4f296bc62f (patch) | |
tree | 8c32a29b3e72dce2728535f4a5ead0be9a7f8e89 /Completion/User/_rlogin | |
parent | fc426939cc5a8bc7acd809f9e013e6c10ede044f (diff) | |
download | zsh-b8bdb144d2a310632efb3bbd7dd78d4f296bc62f.tar.gz zsh-b8bdb144d2a310632efb3bbd7dd78d4f296bc62f.tar.xz zsh-b8bdb144d2a310632efb3bbd7dd78d4f296bc62f.zip |
use basename of commands instead of $words[1]
Diffstat (limited to 'Completion/User/_rlogin')
-rw-r--r-- | Completion/User/_rlogin | 83 |
1 files changed, 74 insertions, 9 deletions
diff --git a/Completion/User/_rlogin b/Completion/User/_rlogin index e36554f23..bf8ff751d 100644 --- a/Completion/User/_rlogin +++ b/Completion/User/_rlogin @@ -1,9 +1,74 @@ -#defcomp rlogin rsh ssh - -if [[ -position 1 ]]; then - complist -k hosts -elif [[ -position 2 ]]; then - complist -k '(-l)' -else - complist -u -fi +#compdef rlogin rsh remsh 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) + 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 + 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 && _rlogin_hosts -S: -q && ret=0 + else + _alternative \ + 'files:: _files' \ + 'hosts:: _rlogin_all_hosts -qS:' \ + 'users:: _rlogin_users -qS@' && ret=0 + fi + fi + return ret + ;; + esac +} + +_rlogin_users () { + _wanted users && _combination -s '[:@]' my-accounts users-hosts users "$@" +} + +_rlogin_hosts () { + _wanted 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 "$@" |