aboutsummaryrefslogtreecommitdiff
path: root/completions/zsh
diff options
context:
space:
mode:
Diffstat (limited to 'completions/zsh')
-rw-r--r--completions/zsh/_rest-run67
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