PageRenderTime 38ms CodeModel.GetById 35ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 1comp_include _dequote _filedir _get_cword _known_hosts
 2
 3
 4_ssh()
 5{
 6    local cur optconfigfile prev
 7    local -a config
 8
 9    COMPREPLY=()
10    cur=`_get_cword`
11    prev=${COMP_WORDS[COMP_CWORD-1]}
12
13    case "$prev" in
14    -F)
15	_filedir
16	;;
17    -*c)
18        COMPREPLY=( $( compgen -W 'blowfish 3des 3des-cbc blowfish-cbc \
19            arcfour cast128-cbc' -- $cur ) )
20        ;;
21    -*i)
22        _filedir
23        ;;
24    -*l)
25        COMPREPLY=( $( compgen -u -- $cur ) )
26        ;;
27    *)
28	# Search COMP_WORDS for '-F[ ]configfile' argument
29	set -- "${COMP_WORDS[@]}"
30	while [ $# -gt 0 ]; do
31	    if [ "${1:0:2}" = -F ]; then
32		if [ ${#1} -gt 2 ]; then
33		    optconfigfile="$(_dequote "$1")"
34		else
35		    shift
36		    [ "$1" ] && optconfigfile="$(_dequote "-F$1")"
37		fi
38		break
39	    fi
40	    shift
41	done
42
43        _known_hosts -a "$optconfigfile"
44
45        [ $COMP_CWORD -eq 1 -o -n "$optconfigfile" ] || \
46	    COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- $cur ) )
47    esac
48
49    return 0
50}