blob: dfa6873e65b61b7c53fc8c2ad99e83df9e5cb2b5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
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
|