diff options
author | Jefferson Julio <[email protected]> | 2022-05-14 20:20:45 -0300 |
---|---|---|
committer | Jefferson Julio <[email protected]> | 2022-05-14 20:20:45 -0300 |
commit | fbf272d4db1a28f4a56a9c8e8de9d0c6de33d218 (patch) | |
tree | 0aa7c156eb3fc9859a84db6c4ccd3913f424a0f6 /completions/zsh/_rest-run | |
parent | 2ff04235bce9bfc7a31ae5b612d87ebbb53f3fa6 (diff) | |
download | rest-run-fbf272d4db1a28f4a56a9c8e8de9d0c6de33d218.tar.bz2 rest-run-fbf272d4db1a28f4a56a9c8e8de9d0c6de33d218.zip |
ZSH completion.
Diffstat (limited to 'completions/zsh/_rest-run')
-rw-r--r-- | completions/zsh/_rest-run | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/completions/zsh/_rest-run b/completions/zsh/_rest-run new file mode 100644 index 0000000..dfa6873 --- /dev/null +++ b/completions/zsh/_rest-run @@ -0,0 +1,67 @@ +#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 |