/bash_completion_lib/complete-nohostcomplete/ssh
http://github.com/brinkman83/bashrc · #! · 50 lines · 43 code · 7 blank · 0 comment · 0 complexity · 443ed8b2dea1f57deaec863e71e42cd9 MD5 · raw file
- comp_include _dequote _filedir _get_cword _known_hosts
- _ssh()
- {
- local cur optconfigfile prev
- local -a config
- COMPREPLY=()
- cur=`_get_cword`
- prev=${COMP_WORDS[COMP_CWORD-1]}
- case "$prev" in
- -F)
- _filedir
- ;;
- -*c)
- COMPREPLY=( $( compgen -W 'blowfish 3des 3des-cbc blowfish-cbc \
- arcfour cast128-cbc' -- $cur ) )
- ;;
- -*i)
- _filedir
- ;;
- -*l)
- COMPREPLY=( $( compgen -u -- $cur ) )
- ;;
- *)
- # 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
- return 0
- }