aboutsummaryrefslogtreecommitdiffstats
path: root/src/_httpie
diff options
context:
space:
mode:
authorVincent Breitmoser <valodim@mugenguild.com>2013-11-06 14:55:26 +0100
committerVincent Breitmoser <valodim@mugenguild.com>2013-11-06 16:54:10 +0100
commitb94ba8198c07b5cb55d98fcfbe9a6ee43f2fdcc8 (patch)
tree5ccc91ad4c2216c4b70c934308c37453a339eb5f /src/_httpie
parent_httpie: properly work with parameters (diff)
downloadzsh-completions-b94ba8198c07b5cb55d98fcfbe9a6ee43f2fdcc8.tar
zsh-completions-b94ba8198c07b5cb55d98fcfbe9a6ee43f2fdcc8.tar.gz
zsh-completions-b94ba8198c07b5cb55d98fcfbe9a6ee43f2fdcc8.tar.bz2
zsh-completions-b94ba8198c07b5cb55d98fcfbe9a6ee43f2fdcc8.tar.lz
zsh-completions-b94ba8198c07b5cb55d98fcfbe9a6ee43f2fdcc8.tar.xz
zsh-completions-b94ba8198c07b5cb55d98fcfbe9a6ee43f2fdcc8.tar.zst
zsh-completions-b94ba8198c07b5cb55d98fcfbe9a6ee43f2fdcc8.zip
_httpie: improve _arguments definitions, add print flags
Diffstat (limited to 'src/_httpie')
-rw-r--r--src/_httpie48
1 files changed, 33 insertions, 15 deletions
diff --git a/src/_httpie b/src/_httpie
index b5a8dbc..66c60cf 100644
--- a/src/_httpie
+++ b/src/_httpie
@@ -98,29 +98,47 @@ _httpie_urls() {
}
+_httpie_printflags () {
+
+ local ret=1
+
+ compset -P '(#b)([a-zA-Z]#)'
+
+ local -a flags
+ [[ $match[1] != *H* ]] && flags+=( "H:request headers" )
+ [[ $match[1] != *B* ]] && flags+=( "B:request body" )
+ [[ $match[1] != *h* ]] && flags+=( "h:response headers" )
+ [[ $match[1] != *b* ]] && flags+=( "b:response body" )
+
+ _describe -t printflags "print flags" flags -S '' && ret=0
+
+ return $ret
+
+}
+
_arguments -C -s \
- {-j,--json}'[Data items from the command line are serialized as a JSON object.]' \
- {-f,--form}'[Data items from the command line are serialized as form fields.]' \
+ '(-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)' \
- {-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)' \
- {-p,--print}'[String specifying what the output should contain]:OUTPUT_OPTIONS:(H B h b)' \
- {-v,--verbose}'[Print the whole request as well as the response.]' \
- {-h,--headers}'[Print only the response headers.]' \
- {-b,--body}'[Print only the response body.]' \
- {-S,--stream}'[Always stream the output by line, i.e., behave like `tail -f`.]' \
- {-o,--output}'[Save output to FILE.]:FILE:_files' \
- {-d,--download}'[Do not print the response body to stdout.]' \
- {-c,--continue}'[Resume an interrupted download.]' \
+ '(-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)' \
+ '(-p --print)'{-p,--print}'=[String specifying what the output should contain]:print flags:_httpie_printflags' \
+ '(-v --verbose)'{-v,--verbose}'[Print the whole request as well as the response.]' \
+ '(-p)'{-h,--headers}'[Print only the response headers.]' \
+ '(-p)'{-b,--body}'[Print only the response body.]' \
+ '(-S --stream)'{-S,--stream}'[Always stream the output by line, i.e., behave like `tail -f`.]' \
+ '(-o --output)'{-o,--output}'[Save output to FILE.]:FILE:_files' \
+ '(-d --download)'{-d,--download}'[Do not print the response body to stdout.]' \
+ '(-c --continue)'{-c,--continue}'[Resume an interrupted download.]' \
'--session[Create, or reuse and update a session.]:SESSION_NAME_OR_PATH' \
'--session-read-only[Create or read a session without updating it form the request/response exchange.]:SESSION_NAME_OR_PATH' \
- {-a,--auth}'[If only the username is provided (-a username)]:USER\:PASS' \
+ '(-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)' \
'--proxy[String mapping protocol to the URL of the proxy (e.g.http:foo.bar:3128).]:PROXY' \
'--follow[Set this flag if full redirects are allowed]' \
- "--verify[Set to \"no\" to skip checking the host's SSL certificate.]:VERIFY:(yes no)" \
+ "--verify[Set to \"no\" to skip checking the host's SSL certificate.]:verify certificate:(yes no)" \
'--allow-redirects[Set this flag if full redirects are allowed (e.g. re-POST-ing of data at new ``Location``)]' \
- '--timeout[Float describes the timeout of the request (Use socket.setdefaulttimeout() as fallback).]:SECONDS' \
- '--check-status[This flag instructs HTTPie to also check the HTTP status code and exit with an error if the status indicates one. ]' \
+ '--timeout[Float describes the timeout of the request (Use socket.setdefaulttimeout() as fallback).]:timeout (seconds)' \
+ '--check-status[This flag instructs HTTPie to also check the HTTP status code and exit with an error if the status indicates one.]' \
'--ignore-stdin[Do not attempt to read stdin.]' \
'--help[show help message.]' \
"--version[show program's version number and exit.]" \