Skip to content

Commit

Permalink
Merge pull request #5 from casconed/autocomplete-host-alias-ssh-config
Browse files Browse the repository at this point in the history
add host alias from ~/.ssh/config to bash autocomplete
  • Loading branch information
m14t authored Oct 27, 2020
2 parents 8ed54db + 664faf0 commit 1e8b6a2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions .bash_autocomplete
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ BASH_UTILS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

source "$BASH_UTILS_DIR/.bash_autocomplete_hub"
source "$BASH_UTILS_DIR/.bash_autocomplete_npm"
source "$BASH_UTILS_DIR/.bash_autocomplete_ssh"
8 changes: 8 additions & 0 deletions .bash_autocomplete_ssh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
_ssh()
{
local cur use
cur="${COMP_WORDS[COMP_CWORD]}"
use=$(grep '^Host' ~/.ssh/config ~/.ssh/config.d/* 2>/dev/null | grep -v '[?*]' | cut -d ' ' -f 2-)
COMPREPLY=( $(compgen -W "$use" -- ${cur}) )
}
complete -F _ssh ssh

0 comments on commit 1e8b6a2

Please sign in to comment.