[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 4fce53700073a9d65ebd20ac5756068fae32bc38
Guillaume Rousse
guillomovitch at zarb.org
Tue May 5 20:49:34 UTC 2009
The following commit has been merged in the master branch:
commit d8bb766fbe3b03b0decd110e9bfd0b16dc594431
Author: Guillaume Rousse <guillomovitch at 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_WORDS[@]}"
- 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=( "${COMPREPLY[@]}" $( 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_WORDS[@]}"
+ 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=( "${COMPREPLY[@]}" $( compgen -c -- $cur ) )
+ fi
+ fi
+
return 0
}
shopt -u hostcomplete && complete -F _ssh ssh slogin sftp xhost autossh
--
bash-completion
More information about the Bash-completion-commits
mailing list