Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

ssh host completion #31

Closed
wants to merge 2 commits into from

1 participant

@shenie

Hi,

I've ported my ssh host completion to your repo.

Cheers,
Andy

Andy Shen added some commits
@ghost

Awesome! Thanks for the contribution!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 4, 2010
  1. ssh completion using .ssh/config

    Andy Shen authored
  2. update credit

    Andy Shen authored
This page is out of date. Refresh to see the latest.
Showing with 15 additions and 0 deletions.
  1. +2 −0  README.md
  2. +13 −0 completion/ssh.completion.bash
View
2  README.md
@@ -54,6 +54,7 @@ If you are submitting a pull request, please add your name to the list.
* [Simon H. Eskildsen][sirupsen]
* [Mark Szymanski][mrman208]
* [Florian Baumann][noqqe]
+* [Andy Shen][shenie]
[revans]: http://github.com/revans
[zerobearing2]: http://github.com/zerobearing2
@@ -62,4 +63,5 @@ If you are submitting a pull request, please add your name to the list.
[sirupsen]: http://github.com/sirupsen
[mrman208]: http://github.com/mrman208
[noqqe]: http://github.com/noqqe
+[shenie]: http://github.com/shenie
View
13 completion/ssh.completion.bash
@@ -0,0 +1,13 @@
+#!/bin/bash
+# Bash completion support for ssh.
+
+export COMP_WORDBREAKS=${COMP_WORDBREAKS/\:/}
+
+_sshcomplete() {
+ if [ -f $HOME/.ssh/config ]; then
+ COMPREPLY=($(compgen -W "`ruby -e"puts open('${HOME}/.ssh/config', 'r') { |f| f.readlines }.find_all { |l| l =~ /^Host/ }.inject([]) { |hosts, line| hosts << line[5..-1].split }.flatten.sort.uniq"`" -- ${COMP_WORDS[COMP_CWORD]}))
+ return 0
+ fi
+}
+
+complete -o default -o nospace -F _sshcomplete ssh
Something went wrong with that request. Please try again.