|
| 1 | +function __fish_httpie_styles |
| 2 | + printf '%s\n' abap algol algol_nu arduino auto autumn borland bw colorful default emacs friendly fruity gruvbox-dark gruvbox-light igor inkpot lovelace manni material monokai murphy native 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 |
| 3 | +end |
| 4 | + |
| 5 | +function __fish_httpie_mime_types |
| 6 | + test -r /usr/share/mime/types && cat /usr/share/mime/types |
| 7 | +end |
| 8 | + |
| 9 | +function __fish_httpie_print_args |
| 10 | + set -l arg (commandline -t) |
| 11 | + string match -qe H "$arg" || echo -e $arg"H\trequest headers" |
| 12 | + string match -qe B "$arg" || echo -e $arg"B\trequest body" |
| 13 | + string match -qe h "$arg" || echo -e $arg"h\tresponse headers" |
| 14 | + string match -qe b "$arg" || echo -e $arg"b\tresponse body" |
| 15 | + string match -qe m "$arg" || echo -e $arg"m\tresponse metadata" |
| 16 | +end |
| 17 | + |
| 18 | +function __fish_httpie_auth_types |
| 19 | + echo -e "basic\tBasic HTTP auth" |
| 20 | + echo -e "digest\tDigest HTTP auth" |
| 21 | + echo -e "bearer\tBearer HTTP Auth" |
| 22 | +end |
| 23 | + |
| 24 | +function __fish_http_verify_options |
| 25 | + echo -e "yes\tEnable cert verification" |
| 26 | + echo -e "no\tDisable cert verification" |
| 27 | +end |
| 28 | + |
| 29 | + |
| 30 | +# Predefined Content Types |
| 31 | + |
| 32 | +complete -c http -s j -l json -d 'Data items are serialized as a JSON object' |
| 33 | +complete -c http -s f -l form -d 'Data items are serialized as form fields' |
| 34 | +complete -c http -l multipart -d 'Always sends a multipart/form-data request' |
| 35 | +complete -c http -l boundary -x -d 'Custom boundary string for multipart/form-data requests' |
| 36 | +complete -c http -l raw -x -d 'Pass raw request data without extra processing' |
| 37 | + |
| 38 | + |
| 39 | +# Content Processing Options |
| 40 | + |
| 41 | +complete -c http -s x -l compress -d 'Content compressed with Deflate algorithm' |
| 42 | + |
| 43 | + |
| 44 | +# Output Processing |
| 45 | + |
| 46 | +complete -c http -l pretty -xa "all colors format none" -d 'Controls output processing' |
| 47 | +complete -c http -s s -l style -xa "(__fish_httpie_styles)" -d 'Output coloring style' |
| 48 | +complete -c http -l unsorted -d 'Disables all sorting while formatting output' |
| 49 | +complete -c http -l sorted -d 'Re-enables all sorting options while formatting output' |
| 50 | +complete -c http -l response-charset -x -d 'Override the response encoding' |
| 51 | +complete -c http -l response-mime -xa "(__fish_httpie_mime_types)" -d 'Override the response mime type for coloring and formatting' |
| 52 | +complete -c http -l format-options -x -d 'Controls output formatting' |
| 53 | + |
| 54 | + |
| 55 | +# Output Options |
| 56 | + |
| 57 | +complete -c http -s p -l print -xa "(__fish_httpie_print_args)" -d 'String specifying what the output should contain' |
| 58 | +complete -c http -s h -l headers -d 'Print only the response headers' |
| 59 | +complete -c http -s m -l meta -d 'Print only the response metadata' |
| 60 | +complete -c http -s b -l body -d 'Print only the response body' |
| 61 | +complete -c http -s v -l verbose -d 'Print the whole request as well as the response' |
| 62 | +complete -c http -l all -d 'Show any intermediary requests/responses' |
| 63 | +complete -c http -s S -l stream -d 'Always stream the response body by line' |
| 64 | +complete -c http -s o -l output -F -d 'Save output to FILE' |
| 65 | +complete -c http -s d -l download -d 'Download a file' |
| 66 | +complete -c http -s c -l continue -d 'Resume an interrupted download' |
| 67 | +complete -c http -s q -l quiet -d 'Do not print to stdout or stderr' |
| 68 | + |
| 69 | + |
| 70 | +# Sessions |
| 71 | + |
| 72 | +complete -c http -l session -F -d 'Create, or reuse and update a session' |
| 73 | +complete -c http -l session-read-only -F -d 'Create or read a session without updating it' |
| 74 | + |
| 75 | + |
| 76 | +# Authentication |
| 77 | + |
| 78 | +complete -c http -s a -l auth -x -d 'Username and password for authentication' |
| 79 | +complete -c http -s A -l auth-type -xa "(__fish_httpie_auth_types)" -d 'The authentication mechanism to be used' |
| 80 | +complete -c http -l ignore-netrc -d 'Ignore credentials from .netrc' |
| 81 | + |
| 82 | + |
| 83 | +# Network |
| 84 | + |
| 85 | +complete -c http -l offline -d 'Build the request and print it but don\'t actually send it' |
| 86 | +complete -c http -l proxy -x -d 'String mapping protocol to the URL of the proxy' |
| 87 | +complete -c http -s F -l follow -d 'Follow 30x Location redirects' |
| 88 | +complete -c http -l max-redirects -x -d 'Set maximum number of redirects' |
| 89 | +complete -c http -l max-headers -x -d 'Maximum number of response headers to be read before giving up' |
| 90 | +complete -c http -l timeout -x -d 'Connection timeout in seconds' |
| 91 | +complete -c http -l check-status -d 'Error with non-200 HTTP status code' |
| 92 | +complete -c http -l path-as-is -d 'Bypass dot segment URL squashing' |
| 93 | +complete -c http -l chunked -d 'Enable streaming via chunked transfer encoding' |
| 94 | + |
| 95 | + |
| 96 | +# SSL |
| 97 | + |
| 98 | +complete -c http -l verify -xa "(__fish_http_verify_options)" -d 'Enable/disable cert verification' |
| 99 | +complete -c http -l ssl -x -d 'Desired protocol version to use' |
| 100 | +complete -c http -l ciphers -x -d 'String in the OpenSSL cipher list format' |
| 101 | +complete -c http -l cert -F -d 'Client side SSL certificate' |
| 102 | +complete -c http -l cert-key -F -d 'Private key to use with SSL' |
| 103 | +complete -c http -l cert-key-pass -x -d 'Passphrase for the given private key' |
| 104 | + |
| 105 | + |
| 106 | +# Troubleshooting |
| 107 | + |
| 108 | +complete -c http -s I -l ignore-stdin -d 'Do not attempt to read stdin' |
| 109 | +complete -c http -l help -d 'Show help' |
| 110 | +complete -c http -l manual -d 'Show the full manual' |
| 111 | +complete -c http -l version -d 'Show version' |
| 112 | +complete -c http -l traceback -d 'Prints exception traceback should one occur' |
| 113 | +complete -c http -l default-scheme -x -d 'The default scheme to use' |
| 114 | +complete -c http -l debug -d 'Show debugging output' |
| 115 | + |
| 116 | + |
| 117 | +# Alias for https to http |
| 118 | + |
| 119 | +complete -c https -w http |
0 commit comments