_ossh_zsh_completion 547 B

1234567891011121314151617181920
  1. #compdef ossh
  2. _ossh_known_hosts(){
  3. if [[ -f ~/.ansible/tmp/multi_ec2_inventory.cache ]]; then
  4. /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()])'
  5. fi
  6. }
  7. _ossh(){
  8. local curcontext="$curcontext" state line
  9. typeset -A opt_args
  10. _arguments -s : \
  11. "*:Hosts:_ossh_known_hosts"
  12. case $state in
  13. *)
  14. }
  15. _ossh "$@"