aboutsummaryrefslogtreecommitdiffstats
path: root/src/_httpie
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2013-11-06 16:32:57 +0100
committerVincent Breitmoser <valodim@mugenguild.com>2013-11-06 16:54:12 +0100
commitdbd9c214fc50ecbb793fac4cd03a59554452d458 (patch)
treeb4ca4fb7cb5da071002a0cf1c28ebf081b0a6b7b /src/_httpie
parent_httpie: improve _arguments definitions, add print flags (diff)
downloadzsh-completions-dbd9c214fc50ecbb793fac4cd03a59554452d458.tar
zsh-completions-dbd9c214fc50ecbb793fac4cd03a59554452d458.tar.gz
zsh-completions-dbd9c214fc50ecbb793fac4cd03a59554452d458.tar.bz2
zsh-completions-dbd9c214fc50ecbb793fac4cd03a59554452d458.tar.lz
zsh-completions-dbd9c214fc50ecbb793fac4cd03a59554452d458.tar.xz
zsh-completions-dbd9c214fc50ecbb793fac4cd03a59554452d458.tar.zst
zsh-completions-dbd9c214fc50ecbb793fac4cd03a59554452d458.zip
_httpie: use NORMARG for positioning
Diffstat (limited to 'src/_httpie')
-rw-r--r--src/_httpie10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/_httpie b/src/_httpie
index 66c60cf..9eb49f0 100644
--- a/src/_httpie
+++ b/src/_httpie
@@ -22,11 +22,11 @@ _httpie_params () {
local ret=1 expl
# or a url
- if (( CURRENT <= 3 )) && [[ $words[2] != *:* ]] ; then
+ if (( CURRENT <= NORMARG+1 )) && [[ $words[NORMARG] != *:* ]] ; then
_httpie_urls && ret=0
# regular param, if we already have a url
- elif (( CURRENT > 2 )); then
+ elif (( CURRENT > NORMARG )); then
# if the suffix is precisely : this is shorthand for a header
if [[ -prefix ':' ]]; then
@@ -74,7 +74,7 @@ _httpie_params () {
fi
# first arg may be a request method
- (( CURRENT == 2 )) &&
+ (( CURRENT == NORMARG )) &&
_wanted http_method expl 'Request Method' \
compadd GET POST PUT DELETE HEAD OPTIONS TRACE CONNECT PATCH LINK UNLINK && ret=0
@@ -116,7 +116,9 @@ _httpie_printflags () {
}
-_arguments -C -s \
+integer NORMARG
+
+_arguments -n -C -s \
'(-f)'{-j,--json}'[Data items from the command line are serialized as a JSON object.]' \
'(-j)'{-f,--form}'[Data items from the command line are serialized as form fields.]' \
'--pretty[Controls output processing.]:PRETTY:(all colors format none)' \