From d124436d94a1e502f7f31a6958d01a513c8cb1a5 Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Wed, 4 Feb 2015 13:37:34 -0500 Subject: Adding [tab] completion for bash and zsh. --- bin/_ossh_zsh_completion | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 bin/_ossh_zsh_completion (limited to 'bin/_ossh_zsh_completion') diff --git a/bin/_ossh_zsh_completion b/bin/_ossh_zsh_completion new file mode 100644 index 000000000..05352bbbb --- /dev/null +++ b/bin/_ossh_zsh_completion @@ -0,0 +1,20 @@ +#compdef ossh + +_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 curcontext="$curcontext" state line + typeset -A opt_args + + _arguments -s : \ + "*:Hosts:_ossh_known_hosts" + + case $state in + *) + +} +_ossh "$@" -- cgit v1.2.3