Skip to content

Commit 7051379

Browse files
yedayakscop
authored andcommitted
feat(curl): Complete protocols for --proto-default
1 parent ef25163 commit 7051379

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

completions/curl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ _comp_cmd_curl()
2222
--happy-eyeballs-timeout-ms | --hostpubmd5 | --keepalive-time | \
2323
--limit-rate | --local-port | --login-options | --mail-auth | \
2424
--mail-from | --mail-rcpt | --max-filesize | --max-redirs | \
25-
--max-time | --pass | --proto | --proto-default | --proto-redir | \
25+
--max-time | --pass | --proto | --proto-redir | \
2626
--proxy-ciphers | --proxy-pass | --proxy-service-name | \
2727
--proxy-tls13-ciphers | --proxy-tlspassword | --proxy-tlsuser | \
2828
--proxy-user | --proxy1.0 | --quote | --range | --referer | \
@@ -127,6 +127,9 @@ _comp_cmd_curl()
127127
_comp_compgen_known_hosts -- "$cur"
128128
return
129129
;;
130+
--proto-default)
131+
_comp_compgen_split "$("$1" --version 2>/dev/null | command sed -e '/Protocols/!d' -e 's/Protocols://')"
132+
;;
130133
--pubkey)
131134
_comp_compgen -x ssh identityfile pub
132135
return

test/t/test_curl.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ def test_data_atfile_dir(self, completion):
2727
assert completion == "d/"
2828
assert not completion.endswith(" ")
2929

30+
@pytest.mark.complete("curl --proto-default ", require_cmd=True)
31+
def test_proto_default(self, completion):
32+
assert completion
33+
3034
@pytest.mark.complete("curl --dont-fail-in-unset-mode")
3135
def test_unknown_option(self, completion):
3236
# Just see that it does not error out

0 commit comments

Comments
 (0)