Merge 74fa111118
into 4fec0a46e7
This commit is contained in:
commit
56304a8c87
107
plugins/apex/_apex
Normal file
107
plugins/apex/_apex
Normal file
@ -0,0 +1,107 @@
|
||||
#compdef apex
|
||||
|
||||
__function_list() {
|
||||
declare -a func_cmd
|
||||
func_cmd=($(apex list 2>/dev/null | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" | cut -d' ' -f3))
|
||||
if [ -n "$func_cmd" ]
|
||||
_describe 'functions' func_cmd
|
||||
}
|
||||
|
||||
__deploy() {
|
||||
_arguments \
|
||||
'(-c|--concurrency)'{-c,--concurrency}'[Concurrent deploys (default 5)]'
|
||||
__function_list
|
||||
}
|
||||
|
||||
__invoke() {
|
||||
_arguments \
|
||||
'(-L|--logs)'{-l,--logs}'[Print logs]'
|
||||
__function_list
|
||||
}
|
||||
|
||||
__delete() {
|
||||
_arguments \
|
||||
'(-f|--force)'{-f,--force}'[Force deletion]'
|
||||
__function_list
|
||||
}
|
||||
|
||||
__rollback() {
|
||||
if ((CURRENT == 3)); then
|
||||
return
|
||||
fi
|
||||
__function_list
|
||||
}
|
||||
|
||||
__build() {
|
||||
if ((CURRENT == 3)); then
|
||||
return
|
||||
fi
|
||||
__function_list
|
||||
}
|
||||
|
||||
__list() {
|
||||
_arguments \
|
||||
'--tfvars[Output as Terraform variables]'
|
||||
}
|
||||
|
||||
__metrics() {
|
||||
_arguments \
|
||||
'(-s,--start)'{-s,--start}'[Start time of the results (default 24h0m0s)]'
|
||||
__function_list
|
||||
}
|
||||
|
||||
__logs() {
|
||||
_arguments \
|
||||
'(-F,--filter)'{-f,--filter}'[Filter logs with pattern]' \
|
||||
'(-f,--follow)'{-f,--filter}'[Follow tail logs for updates]' \
|
||||
'(-s,--start)'{-s,--start}'[Start time of the search (default 5m0s)]'
|
||||
__function_list
|
||||
}
|
||||
|
||||
__docs() {
|
||||
_arguments '*:files:_files'
|
||||
}
|
||||
|
||||
local -a _1st_arguments
|
||||
_1st_arguments=(
|
||||
'deploy:Deploy functions and config'
|
||||
'invoke:Invoke functions'
|
||||
'delete:Delete functions'
|
||||
'rollback:Rollback a function'
|
||||
'build:Build a function'
|
||||
'list:List functions'
|
||||
'metrics:Output function metrics'
|
||||
'logs:Output function logs'
|
||||
'docs:Output documentation'
|
||||
'version:Print version of Apex'
|
||||
'upgrade:Ugrade apex to the latest stable release'
|
||||
)
|
||||
|
||||
_arguments '*:: :->command'
|
||||
|
||||
if (( CURRENT == 1 )); then
|
||||
_describe -t commands "apex command" _1st_arguments
|
||||
return
|
||||
fi
|
||||
|
||||
local -a _command_args
|
||||
case "$words[1]" in
|
||||
deploy)
|
||||
__deploy ;;
|
||||
invoke)
|
||||
__invoke ;;
|
||||
delete)
|
||||
__delete ;;
|
||||
rollback)
|
||||
__rollback ;;
|
||||
build)
|
||||
__build ;;
|
||||
list)
|
||||
__list ;;
|
||||
metrics)
|
||||
__metrics ;;
|
||||
logs)
|
||||
__logs ;;
|
||||
docs)
|
||||
__docs ;;
|
||||
esac
|
Loading…
Reference in New Issue
Block a user