#compdef _rest-run rest-run # zsh completion for rest-run -*- shell-script -*- function __debug { echo "$1" >> /tmp/_rest-run.log } function _rest-run { local line local -a args args+=( '1:*:(POST GET PUT PATCH DELETE)' '--no-edit[Skip request body edit]' '--body[Body options]: :_rest-run_body_opts' '--response[Response options]: :_rest-run_response_opts' '*-h[HTTP header]' '--paginate[Paginate request response]' ) _arguments -C $args } function _rest-run_body_opts { local -a _descriptions _values _descriptions=( 'default -- create a request body using the default editor' 'last -- use the last request' 'history -- pick from the request history' 'stdin -- reads from piped input' ) _values=( 'default' 'last' 'history' 'stdin' ) compadd -d _descriptions -a _values } function _rest-run_response_opts { local -a _descriptions _values _descriptions=( 'default -- store the request on cache' 'last -- read last request, skip request' 'history -- pick from the response history, skip request' ) _values=( 'default' 'last' 'history' ) compadd -d _descriptions -a _values } if [ "$funcstack[1]" = "_rest-run" ]; then _rest-run fi compdef _rest-run rest-run