a8cd5a2fe9
Sure hope I didn't miss any super secret crap :-P
18 lines
354 B
Bash
18 lines
354 B
Bash
_get_ssh_hosts(){
|
|
cat $HOME/.ssh/config | grep '^Host ' | sed "s/Host //"
|
|
}
|
|
|
|
_ssh(){
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
|
# prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
if [ $COMP_CWORD -eq 1 ]; then
|
|
COMPREPLY=( $( compgen -W "$(_get_ssh_hosts)" $cur ) )
|
|
fi
|
|
}
|
|
|
|
complete -F _ssh -o default ssh
|
|
complete -F _ssh -o default scp
|
|
|
|
|
|
# vim:filetype=sh
|