From ca585f812b02071cc261fb9dbe463bab6f8be602 Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Mon, 15 Jan 2001 09:11:31 +0000 Subject: add `services', allowing easier re-use of (parts of) completion functions (13346) --- Completion/User/_ssh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'Completion/User/_ssh') diff --git a/Completion/User/_ssh b/Completion/User/_ssh index c6a6898f1..7e81123ef 100644 --- a/Completion/User/_ssh +++ b/Completion/User/_ssh @@ -1,9 +1,12 @@ -#compdef ssh slogin scp ssh-add ssh-agent ssh-keygen +#compdef ssh slogin=ssh scp ssh-add ssh-agent ssh-keygen _remote_files () { # This is extremely simple-minded; could parse "ls -F" output to do # colorings and LIST_TYPES and so on, but I'm just not that ambitious. - compadd $(ssh -a -x ${words[CURRENT]%:*} echo ${words[CURRENT]#*:}\*) + local expl + + _wanted files expl 'remote files' \ + compadd $(ssh -a -x ${words[CURRENT]%:*} echo ${words[CURRENT]#*:}\*) } _ssh () { @@ -14,8 +17,8 @@ _ssh () { # ssh-opt is a pseudo-command used to complete ssh options for `scp -o'. - case "${words[1]:t}" in - ssh|slogin) + case "$service" in + ssh) args=( ':remote host name:->userhost' '(-):command: _command_names -e' @@ -179,6 +182,7 @@ _ssh () { compset -q words=(ssh-opt "$words[@]" ) (( CURRENT++ )) + service=ssh-opt _ssh return elif [[ -n "$state" ]]; then -- cgit v1.3.1