2015-03-25 04:26:10 +02:00
|
|
|
_http_complete() {
|
2015-06-26 16:25:53 +02:00
|
|
|
local cur_word=${COMP_WORDS[COMP_CWORD]}
|
|
|
|
local prev_word=${COMP_WORDS[COMP_CWORD - 1]}
|
2015-03-25 04:26:10 +02:00
|
|
|
|
2021-09-03 15:05:03 +02:00
|
|
|
if [[ "$cur_word" == -* ]]; then
|
2015-06-26 16:25:53 +02:00
|
|
|
_http_complete_options "$cur_word"
|
|
|
|
fi
|
2015-03-25 04:26:10 +02:00
|
|
|
}
|
|
|
|
|
2021-10-25 16:36:34 +02:00
|
|
|
complete -o default -F _http_complete http httpie.http httpie.https https
|
2015-03-25 04:26:10 +02:00
|
|
|
|
|
|
|
_http_complete_options() {
|
2015-06-26 16:25:53 +02:00
|
|
|
local cur_word=$1
|
|
|
|
local options="-j --json -f --form --pretty -s --style -p --print
|
|
|
|
-v --verbose -h --headers -b --body -S --stream -o --output -d --download
|
|
|
|
-c --continue --session --session-read-only -a --auth --auth-type --proxy
|
|
|
|
--follow --verify --cert --cert-key --timeout --check-status --ignore-stdin
|
2021-05-24 14:29:54 +02:00
|
|
|
--help --version --traceback --debug --raw"
|
2015-06-26 16:25:53 +02:00
|
|
|
COMPREPLY=( $( compgen -W "$options" -- "$cur_word" ) )
|
2015-03-25 04:26:10 +02:00
|
|
|
}
|