summaryrefslogtreecommitdiffstats
path: root/bin/_ossh_zsh_completion
blob: 05352bbbb93dab5778fc1617f4d486b8adf52fd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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 "$@"