diff options
author | Kenny Woodson <kwoodson@redhat.com> | 2015-02-04 12:06:41 -0500 |
---|---|---|
committer | Kenny Woodson <kwoodson@redhat.com> | 2015-02-04 12:06:41 -0500 |
commit | fe7d30b762357ac4ec1fe2b173320d463267ac82 (patch) | |
tree | 71db1d119efce310c1046344f52379eb6b7e751e /bin/ossh_bash_completion | |
parent | 6481ca629cc2bcf5bd9c7f15be14a77e57086514 (diff) | |
download | openshift-fe7d30b762357ac4ec1fe2b173320d463267ac82.tar.gz openshift-fe7d30b762357ac4ec1fe2b173320d463267ac82.tar.bz2 openshift-fe7d30b762357ac4ec1fe2b173320d463267ac82.tar.xz openshift-fe7d30b762357ac4ec1fe2b173320d463267ac82.zip |
Renamed ossh.py and added bash completion function
Diffstat (limited to 'bin/ossh_bash_completion')
-rwxr-xr-x | bin/ossh_bash_completion | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/bin/ossh_bash_completion b/bin/ossh_bash_completion new file mode 100755 index 000000000..0d0bdb0e6 --- /dev/null +++ b/bin/ossh_bash_completion @@ -0,0 +1,18 @@ +__ossh_known_hosts(){ + if [[ -f ~/.ansible/tmp/multi_ec2_inventory.cache ]]; then + /usr/bin/python -c 'import json,os; z = json.loads(open("%s"%os.path.expanduser("~/.ansible/tmp/multi_ec2_inventory.cache")).read()); print "\n".join(["%s.%s" % (host["ec2_tag_Name"],host["ec2_tag_environment"]) for dns, host in z["_meta"]["hostvars"].items()])' + fi +} + +_ossh() +{ + local cur prev known_hosts + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + known_hosts="$(__ossh_known_hosts)" + COMPREPLY=( $(compgen -W "${known_hosts}" -- ${cur})) + + return 0 +} +complete -F _ossh ossh |