1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
#!/bin/bash completion for oci-cluster-upgrade-openstack-release
_oci_cluster_upgrade_openstack_release() {
local cur prev cmd_name
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
case ${COMP_CWORD} in
1)
local cluster_list=$(ocicli -csv cluster-list | grep -v "id,name,domain" | cut -d, -f2 | tr \\n " ")
COMPREPLY=( $(compgen -W "${cluster_list}" -- ${cur}) )
return 0
;;
2)
COMPREPLY=( $(compgen -W "victoria wallaby xena yoga zed antelope bobcat caracal dalmatian epoxy flamingo gazpacho" -- ${cur}) )
return 0
;;
3)
case ${prev} in
"victoria")
COMPREPLY=( $(compgen -W "wallaby" -- ${cur}) )
;;
"wallaby")
COMPREPLY=( $(compgen -W "xena" -- ${cur}) )
;;
"xena")
COMPREPLY=( $(compgen -W "yoga" -- ${cur}) )
;;
"yoga")
COMPREPLY=( $(compgen -W "zed" -- ${cur}) )
;;
"zed")
COMPREPLY=( $(compgen -W "antelope" -- ${cur}) )
;;
"antelope")
COMPREPLY=( $(compgen -W "bobcat caracal" -- ${cur}) )
;;
"bobcat")
COMPREPLY=( $(compgen -W "caracal" -- ${cur}) )
;;
"caracal")
COMPREPLY=( $(compgen -W "dalmatian epoxy" -- ${cur}) )
;;
"epoxy")
COMPREPLY=( $(compgen -W "flamingo gazpacho" -- ${cur}) )
;;
"flamingo")
COMPREPLY=( $(compgen -W "gazpacho" -- ${cur}) )
;;
*)
return 0
;;
esac
;;
*)
return 0
;;
esac
}
complete -F _oci_cluster_upgrade_openstack_release oci-cluster-upgrade-openstack-release
|