aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJefferson Julio <[email protected]>2022-05-15 21:07:11 -0300
committerJefferson Julio <[email protected]>2022-05-15 21:07:11 -0300
commit7a1d0f95822a06be1db201ad3724e51a2160818d (patch)
tree37cfda2daa5aab69d625bb6c4334aaef65ffe26c
parentd4305ad115c9e1ac4f62bfaa05929f2de8a5999d (diff)
downloadrest-run-7a1d0f95822a06be1db201ad3724e51a2160818d.tar.bz2
rest-run-7a1d0f95822a06be1db201ad3724e51a2160818d.zip
Update ZSH completions.
-rw-r--r--completions/zsh/_rest-run15
1 files changed, 14 insertions, 1 deletions
diff --git a/completions/zsh/_rest-run b/completions/zsh/_rest-run
index 003caaf..c9a642b 100644
--- a/completions/zsh/_rest-run
+++ b/completions/zsh/_rest-run
@@ -22,6 +22,7 @@ function _rest-run {
args+=(
'1:*:(POST GET PUT PATCH DELETE)'
+ '2:*:_rest-run_url_opts'
'-ne[Skip request body edit]'
'-b[Body options]: :_rest-run_body_opts'
'-r[Response options]: :_rest-run_response_opts'
@@ -36,6 +37,18 @@ function _rest-run {
_arguments -C $args
}
+function _rest-run_url_opts {
+ local -a _values
+
+ _values=()
+
+ tail -n -50 $HOME/.cache/rest-run/request-history 2> /dev/null | while read -r line; do
+ _values+=("$(echo $line | sed 's/^[A-Z]*\s//g')")
+ done
+
+ compadd -a _values
+}
+
function _rest-run_body_opts {
local -a _descriptions _values
@@ -100,7 +113,7 @@ function _rest-run_select_response_opts {
local domain="$(_rest-run_read_domain)"
local -a _values
- for f in $(find $HOME/.cache/rest-run/$domain -type f -iname '*response*'); do
+ for f in $(find $HOME/.cache/rest-run/$domain -type f -iname '*response*.log' 2> /dev/null | head -50); do
_values+=("$(echo "$f" | sed 's/^.*\/\.cache\/rest-run\///g')")
done