Skip to content

Commit

Permalink
feat(curl): Complete protocols for --proto-default
Browse files Browse the repository at this point in the history
  • Loading branch information
yedayak authored and scop committed Apr 1, 2024
1 parent ef25163 commit 7051379
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion completions/curl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ _comp_cmd_curl()
--happy-eyeballs-timeout-ms | --hostpubmd5 | --keepalive-time | \
--limit-rate | --local-port | --login-options | --mail-auth | \
--mail-from | --mail-rcpt | --max-filesize | --max-redirs | \
--max-time | --pass | --proto | --proto-default | --proto-redir | \
--max-time | --pass | --proto | --proto-redir | \
--proxy-ciphers | --proxy-pass | --proxy-service-name | \
--proxy-tls13-ciphers | --proxy-tlspassword | --proxy-tlsuser | \
--proxy-user | --proxy1.0 | --quote | --range | --referer | \
Expand Down Expand Up @@ -127,6 +127,9 @@ _comp_cmd_curl()
_comp_compgen_known_hosts -- "$cur"
return
;;
--proto-default)
_comp_compgen_split "$("$1" --version 2>/dev/null | command sed -e '/Protocols/!d' -e 's/Protocols://')"
;;
--pubkey)
_comp_compgen -x ssh identityfile pub
return
Expand Down
4 changes: 4 additions & 0 deletions test/t/test_curl.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def test_data_atfile_dir(self, completion):
assert completion == "d/"
assert not completion.endswith(" ")

@pytest.mark.complete("curl --proto-default ", require_cmd=True)
def test_proto_default(self, completion):
assert completion

@pytest.mark.complete("curl --dont-fail-in-unset-mode")
def test_unknown_option(self, completion):
# Just see that it does not error out
Expand Down

0 comments on commit 7051379

Please sign in to comment.