Add support for completing aliases in ssh. Written by David Bronke.

darcs-hash:20090201231805-ac50b-196d4c81981efe681677fe8ca7f1cc833a4734da.gz
This commit is contained in:
axel 2009-02-02 09:18:05 +10:00
parent 33ec8b45a0
commit 9d7224d756
2 changed files with 15 additions and 0 deletions

View file

@ -4,6 +4,11 @@
__fish_complete_ssh ssh
complete -x -c ssh -d Alias -a "
(__fish_print_ssh_aliases)
"
complete -x -c ssh -d Hostname -a "
(__fish_print_hostnames)
@ -12,6 +17,9 @@ complete -x -c ssh -d Hostname -a "
#Prepend any username specified in the completion to the hostname
echo (commandline -ct)|sed -ne 's/\(.*@\).*/\1/p'
)(__fish_print_hostnames)
"
complete -x -c ssh -d User -a "
(__fish_print_users)@
"

View file

@ -0,0 +1,7 @@
function __fish_print_ssh_aliases -d "Print a list of known ssh aliases"
# Print ssh aliases
if test -f ~/.ssh/config
awk '/^[[:space:]]*Host\>/ {print $2}' ~/.ssh/config
end
end