Update httpie completion and reformat code
- Reformat - Remove deprecated options - Add missing candidates of `--style` and `--auth-type`
This commit is contained in:
parent
14da57e8e2
commit
bfc56a2e4c
28
src/_httpie
28
src/_httpie
|
@ -41,8 +41,7 @@
|
|||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
_httpie_params () {
|
||||
|
||||
_httpie_params() {
|
||||
local ret=1 expl
|
||||
|
||||
# or a url
|
||||
|
@ -60,8 +59,7 @@ _httpie_params () {
|
|||
|
||||
# if we are in front of a : (possibly due to the PREFIX move before)
|
||||
if [[ -suffix ':' ]]; then
|
||||
|
||||
# this is rather buggy with normal tab behavior :\
|
||||
# this is rather buggy with normal tab behavior :
|
||||
compstate[insert]=menu
|
||||
_wanted http_header expl 'HTTP Header' \
|
||||
compadd -s ':' -S '' -- Content-Type Cookie && return 0
|
||||
|
@ -106,11 +104,9 @@ _httpie_params () {
|
|||
compadd GET POST PUT DELETE HEAD OPTIONS TRACE CONNECT PATCH LINK UNLINK && ret=0
|
||||
|
||||
return $ret
|
||||
|
||||
}
|
||||
|
||||
_httpie_urls() {
|
||||
|
||||
local ret=1
|
||||
|
||||
if ! [[ -prefix [-+.a-z0-9]#:// ]]; then
|
||||
|
@ -125,8 +121,7 @@ _httpie_urls() {
|
|||
|
||||
}
|
||||
|
||||
_httpie_printflags () {
|
||||
|
||||
_httpie_printflags() {
|
||||
local ret=1
|
||||
|
||||
# not sure why this is necessary, but it will complete "-pH" style without it
|
||||
|
@ -143,7 +138,19 @@ _httpie_printflags () {
|
|||
_describe -t printflags "print flags" flags -S '' && ret=0
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
_httpie_styles() {
|
||||
local -a styles=(abap algol algol_nu arduino auto autumn borland bw
|
||||
colorful default dracula emacs friendly
|
||||
friendly_grayscale fruity gruvbox-dark gruvbox-light
|
||||
igor inkpot lilypond lovelace manni material monokai
|
||||
murphy native one-dark paraiso-dark paraiso-light
|
||||
pastie perldoc pie pie-dark pie-light rainbow_dash
|
||||
rrt sas solarized solarized-dark solarized-light stata
|
||||
stata-dark stata-light tango trac vim vs xcode zenburn)
|
||||
|
||||
_describe -t styles 'style' styles
|
||||
}
|
||||
|
||||
integer NORMARG
|
||||
|
@ -156,7 +163,7 @@ _arguments -n -C -s \
|
|||
'--raw=[This option allows you to pass raw request data without extra processing]' \
|
||||
'(-x --compress)'{-x,--compress}'[Content compressed with Deflate algorithm]' \
|
||||
'--pretty=[Controls output processing.]:output format:(all colors format none)' \
|
||||
'(-s --style)'{-s,--style}'=[Output coloring style]:STYLE:(autumn borland bw colorful default emacs friendly fruity manni monokai murphy native pastie perldoc ttr solarized tango trac vim vs)' \
|
||||
'(-s --style)'{-s,--style}'=[Output coloring style]:STYLE:_httpie_styles' \
|
||||
'--unsorted[Disables all sorting while formatting output]' \
|
||||
'--sorted[Re-enables all sorting options while formatting output]' \
|
||||
'--response-charset=[Override the response encoding for terminal display purposes]' \
|
||||
|
@ -168,7 +175,6 @@ _arguments -n -C -s \
|
|||
'(-p -m --meta)'{-m,--meta}'[Print only the response metadata]' \
|
||||
'(-p -b --body)'{-b,--body}'[Print only the response body.]' \
|
||||
'--all[By default, only the final request/response is shown]' \
|
||||
'(--P --history-print)'{-P,--history-print}'=[The same as --print but applies only to intermediary requests/response]:print flags:_httpie_printflags' \
|
||||
'(-S --stream)'{-S,--stream}'[Always stream the output by line, i.e., behave like `tail -f`.]' \
|
||||
'(-o --output)'{-o,--output}'=[Save output to FILE.]:output file:_files' \
|
||||
'(-d --download)'{-d,--download}'=[Do not print the response body to stdout.]' \
|
||||
|
@ -177,7 +183,7 @@ _arguments -n -C -s \
|
|||
'(--session-read-only)--session=[Create, or reuse and update a session.]:session name (or path)' \
|
||||
'(--session)--session-read-only=[Create or read a session without updating it form the request/response exchange.]:session name (or path)' \
|
||||
'(-a --auth)'{-a,--auth}'=[If only the username is provided (-a username)]:USER\:PASS' \
|
||||
'--auth-type=[The authentication mechanism to be used. Defaults to "basic".]:AUTH-TYPE:(basic digest)' \
|
||||
'--auth-type=[The authentication mechanism to be used. Defaults to "basic".]:AUTH-TYPE:(basic digest bearer)' \
|
||||
'--ignore-netrc[Ignore credentials from .netrc]' \
|
||||
'--offline[Build the request and print it but do not actually send it]' \
|
||||
'--proxy=[String mapping protocol to the URL of the proxy.]:PROXY' \
|
||||
|
|
Loading…
Reference in New Issue