aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/__fish_print_hostnames.fish
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2009-02-03 07:02:42 +1000
committerGravatar axel <axel@liljencrantz.se>2009-02-03 07:02:42 +1000
commit05341b055bb27c9a9036a1ebc99503fd4825e35f (patch)
tree00b29e4c9105337eb1a85434d1d47022f64ba6b9 /share/functions/__fish_print_hostnames.fish
parent9d7224d756e3521dd0f3115874066d386154b438 (diff)
ish's current hostname completion uses ~/.ssh/known_hosts as one of its sources of information, but ~/.ssh/config may also be useful. Gather all of the 'Host' declarations from ~/.ssh/config and filter out the ones with wildcards. Signed-off-by: James Vega <jamessan@debian.org>
darcs-hash:20090202210242-ac50b-cf50070ee33ab6113e32a4d997d464ac4b1faf24.gz
Diffstat (limited to 'share/functions/__fish_print_hostnames.fish')
-rw-r--r--share/functions/__fish_print_hostnames.fish5
1 files changed, 5 insertions, 0 deletions
diff --git a/share/functions/__fish_print_hostnames.fish b/share/functions/__fish_print_hostnames.fish
index 69e41e0d..52efc731 100644
--- a/share/functions/__fish_print_hostnames.fish
+++ b/share/functions/__fish_print_hostnames.fish
@@ -12,5 +12,10 @@ function __fish_print_hostnames -d "Print a list of known hostnames"
# Print hosts with known ssh keys
cat ~/.ssh/known_hosts{,2} ^/dev/null|cut -d ' ' -f 1| cut -d , -f 1
+
+ # Print hosts from ssh configuration file
+ if [ -e ~/.ssh/config ]
+ grep '^ *Host' ~/.ssh/config | grep -v '[*?]' | cut -d ' ' -f 2
+ end
end