From dbd9c214fc50ecbb793fac4cd03a59554452d458 Mon Sep 17 00:00:00 2001 From: Vincent Breitmoser Date: Wed, 6 Nov 2013 16:32:57 +0100 Subject: [PATCH] _httpie: use NORMARG for positioning --- src/_httpie | 10 ++++++---- 1 file 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)' \