_httpie: use NORMARG for positioning

This commit is contained in:
Vincent Breitmoser 2013-11-06 16:32:57 +01:00
parent b94ba8198c
commit dbd9c214fc
1 changed files with 6 additions and 4 deletions

View File

@ -22,11 +22,11 @@ _httpie_params () {
local ret=1 expl local ret=1 expl
# or a url # or a url
if (( CURRENT <= 3 )) && [[ $words[2] != *:* ]] ; then if (( CURRENT <= NORMARG+1 )) && [[ $words[NORMARG] != *:* ]] ; then
_httpie_urls && ret=0 _httpie_urls && ret=0
# regular param, if we already have a url # 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 the suffix is precisely : this is shorthand for a header
if [[ -prefix ':' ]]; then if [[ -prefix ':' ]]; then
@ -74,7 +74,7 @@ _httpie_params () {
fi fi
# first arg may be a request method # first arg may be a request method
(( CURRENT == 2 )) && (( CURRENT == NORMARG )) &&
_wanted http_method expl 'Request Method' \ _wanted http_method expl 'Request Method' \
compadd GET POST PUT DELETE HEAD OPTIONS TRACE CONNECT PATCH LINK UNLINK && ret=0 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.]' \ '(-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.]' \ '(-j)'{-f,--form}'[Data items from the command line are serialized as form fields.]' \
'--pretty[Controls output processing.]:PRETTY:(all colors format none)' \ '--pretty[Controls output processing.]:PRETTY:(all colors format none)' \