The following commit has been merged in the master branch:
commit d8bb766fbe3b03b0decd110e9bfd0b16dc594431
Author: Guillaume Rousse <guillomovi...@zarb.org>
Date:   Sat May 2 16:11:23 2009 +0200

    standardize ssh completion scheme:
    - complete after previous unstacked short options
    - complete potential options after dash
    - complete on known host if neither apply

diff --git a/contrib/ssh b/contrib/ssh
index 85325aa..2aebe62 100644
--- a/contrib/ssh
+++ b/contrib/ssh
@@ -17,39 +17,49 @@ _ssh()
        case "$prev" in
        -F)
                _filedir
+               return 0
                ;;
-       -*c)
+       -c)
            COMPREPLY=( $( compgen -W 'blowfish 3des 3des-cbc blowfish-cbc \
                           arcfour cast128-cbc' -- $cur ) )
+           return 0
            ;;
-       -*i)
+       -i)
            _filedir
+           return 0
            ;;
-       -*l)
+       -l)
            COMPREPLY=( $( compgen -u -- $cur ) )
+           return 0
            ;;
-       *)
-               # Search COMP_WORDS for '-F configfile' argument
-               set -- "${comp_wor...@]}"
-               while [ $# -gt 0 ]; do
-                       if [ "${1:0:2}" = -F ]; then
-                               if [ ${#1} -gt 2 ]; then
-                                       optconfigfile="$(dequote "$1")"
-                               else
-                                       shift
-                                       [ "$1" ] && optconfigfile="$(dequote 
"-F$1")"
-                               fi
-                               break
-                       fi
-                       shift
-               done
-
-           _known_hosts -a "$optconfigfile"
-
-           [ $COMP_CWORD -eq 1 -o -n "$optconfigfile" ] || \
-               COMPREPLY=( "${comprep...@]}" $( compgen -c -- $cur ) )
        esac
 
+       if [[ "$cur" == -* ]]; then
+               COMPREPLY=( $( compgen -W '-1 -2 -4 -6 -A -a -C -f -g -K -k -M \
+                       -N -n -q -s -T -t -V -v -X -v -Y -y -b -b -c -D -e -F \
+                       -i -L -l -m -O -o -p -R -S -w' -- $cur ) )
+       else
+               if [ $COMP_CWORD -eq 1 ]; then
+                       # Search COMP_WORDS for '-F configfile' argument
+                       set -- "${comp_wor...@]}"
+                       while [ $# -gt 0 ]; do
+                               if [ "${1:0:2}" = -F ]; then
+                                       if [ ${#1} -gt 2 ]; then
+                                               optconfigfile="$(dequote "$1")"
+                                       else
+                                               shift
+                                               [ "$1" ] && 
optconfigfile="$(dequote "-F$1")"
+                                       fi
+                                       break
+                               fi
+                               shift
+                       done
+                       _known_hosts -a "$optconfigfile"
+               else
+                       COMPREPLY=( "${comprep...@]}" $( compgen -c -- $cur ) )
+               fi
+       fi
+
        return 0
 }
 shopt -u hostcomplete && complete -F _ssh ssh slogin sftp xhost autossh

-- 
bash-completion

_______________________________________________
Bash-completion-commits mailing list
Bash-completion-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/bash-completion-commits

Reply via email to