2014-12-24 13:15:27 +00:00
|
|
|
_resin() {
|
|
|
|
COMPREPLY=()
|
|
|
|
|
|
|
|
local current="${COMP_WORDS[COMP_CWORD]}"
|
|
|
|
local previous="${COMP_WORDS[COMP_CWORD-1]}"
|
2015-02-09 14:00:16 +00:00
|
|
|
local options="version help login logout signup drive whoami app apps init devices device note preferences keys key envs env logs os examples example"
|
2014-12-24 13:15:27 +00:00
|
|
|
|
|
|
|
case "${previous}" in
|
|
|
|
app)
|
|
|
|
local subcommands="create rm restart"
|
|
|
|
COMPREPLY=( $(compgen -W "${subcommands}" -- ${current}) )
|
|
|
|
return 0 ;;
|
2015-02-09 14:00:16 +00:00
|
|
|
drive)
|
|
|
|
local subcommands="list"
|
|
|
|
COMPREPLY=( $(compgen -W "${subcommands}" -- ${current}) )
|
|
|
|
return 0 ;;
|
2014-12-24 16:49:49 +00:00
|
|
|
devices)
|
|
|
|
local subcommands="supported"
|
|
|
|
COMPREPLY=( $(compgen -W "${subcommands}" -- ${current}) )
|
|
|
|
return 0 ;;
|
2014-12-24 13:15:27 +00:00
|
|
|
device)
|
2015-01-21 15:48:20 +00:00
|
|
|
local subcommands="rename rm identify init"
|
2014-12-24 13:15:27 +00:00
|
|
|
COMPREPLY=( $(compgen -W "${subcommands}" -- ${current}) )
|
|
|
|
return 0 ;;
|
|
|
|
key)
|
|
|
|
local subcommands="add rm"
|
|
|
|
COMPREPLY=( $(compgen -W "${subcommands}" -- ${current}) )
|
|
|
|
return 0 ;;
|
2014-12-24 16:42:51 +00:00
|
|
|
env)
|
2014-12-24 13:15:27 +00:00
|
|
|
local subcommands="add rename rm"
|
|
|
|
COMPREPLY=( $(compgen -W "${subcommands}" -- ${current}) )
|
|
|
|
return 0 ;;
|
|
|
|
os)
|
2015-02-09 14:00:16 +00:00
|
|
|
local subcommands="download install"
|
2014-12-24 13:15:27 +00:00
|
|
|
COMPREPLY=( $(compgen -W "${subcommands}" -- ${current}) )
|
|
|
|
return 0 ;;
|
|
|
|
example)
|
|
|
|
local subcommands="clone"
|
|
|
|
COMPREPLY=( $(compgen -W "${subcommands}" -- ${current}) )
|
|
|
|
return 0 ;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
COMPREPLY=( $(compgen -W "${options}" -- ${current}) )
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
complete -F _resin resin
|