diff options
| author | Thomas Wiest <twiest@users.noreply.github.com> | 2015-03-31 16:46:47 -0400 | 
|---|---|---|
| committer | Thomas Wiest <twiest@users.noreply.github.com> | 2015-03-31 16:46:47 -0400 | 
| commit | 4c7d7d0799e82606596b17158668da5e1d31bba0 (patch) | |
| tree | 09913823299da74b71f40e426c7ee907a53a249c /bin | |
| parent | 4a6d1c328d92047fcd924dce821613c8579f1745 (diff) | |
| parent | d9a178298ae8b6d487baf79559f4d82b2d71e49a (diff) | |
| download | openshift-4c7d7d0799e82606596b17158668da5e1d31bba0.tar.gz openshift-4c7d7d0799e82606596b17158668da5e1d31bba0.tar.bz2 openshift-4c7d7d0799e82606596b17158668da5e1d31bba0.tar.xz openshift-4c7d7d0799e82606596b17158668da5e1d31bba0.zip | |
Merge pull request #134 from kwoodson/completion_fix
Fixing bash completion for ossh/oscp.  Adding for opssh.
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/ossh_bash_completion | 23 | 
1 files changed, 22 insertions, 1 deletions
| diff --git a/bin/ossh_bash_completion b/bin/ossh_bash_completion index 6a95ce6ee..1467de858 100755 --- a/bin/ossh_bash_completion +++ b/bin/ossh_bash_completion @@ -1,6 +1,7 @@  __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()])' +        /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() if all(k in host for k in ("ec2_tag_Name", "ec2_tag_environment"))])' +      fi  } @@ -16,3 +17,23 @@ _ossh()      return 0  }  complete -F _ossh ossh oscp + +__opssh_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" % (host["ec2_tag_host-type"]) for dns, host in z["_meta"]["hostvars"].items() if "ec2_tag_host-type" in host])' +    fi +} + +_opssh() +{ +    local cur prev known_hosts +    COMPREPLY=() +    cur="${COMP_WORDS[COMP_CWORD]}" +    prev="${COMP_WORDS[COMP_CWORD-1]}" +    known_hosts="$(__opssh_known_hosts)" +    COMPREPLY=( $(compgen -W "${known_hosts}" -- ${cur})) + +    return 0 +} +complete -F _opssh opssh + | 
