Skip to content

Commit 6f03827

Browse files
authored
Merge pull request #1237 from yedayak/curl-data-
Complete stdin "-" in file locations, add more options that allow it
2 parents 07605cb + 62c0ecb commit 6f03827

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

completions/curl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ _comp_cmd_curl()
3030
--sasl-authzid | --service-name | --socks5-gssapi-service | \
3131
--speed-limit | --speed-time | --telnet-option | --tftp-blksize | \
3232
--time-cond | --tls13-ciphers | --tlspassword | --tlsuser | \
33-
--url | --user | --user-agent | --version | --write-out | \
34-
-${noargopts}[CFmQreYytzuAVw])
33+
--url | --user | --user-agent | --version | \
34+
-${noargopts}[CFmQreYytzuAV])
3535
return
3636
;;
3737
--cacert | --cert | --proxy-cacert | --proxy-cert | -${noargopts}E)
@@ -50,10 +50,11 @@ _comp_cmd_curl()
5050
_comp_compgen_filedir crl
5151
return
5252
;;
53-
--data | --data-ascii | --data-binary | --data-urlencode | --header | \
54-
--proxy-header | -${noargopts}[dH])
53+
--data | --data-ascii | --data-binary | --data-urlencode | --json | \
54+
--header | --proxy-header | --write-out | -${noargopts}[dHw])
5555
if [[ $cur == \@* ]]; then
5656
_comp_compgen -c "${cur:1}" filedir
57+
_comp_compgen -a -c "${cur:1}" -- -W '-'
5758
if [[ ${#COMPREPLY[@]} -eq 1 && -d ${COMPREPLY[0]} ]]; then
5859
COMPREPLY[0]+=/
5960
compopt -o nospace

test/t/test_curl.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ def test_4(self, completion):
2020

2121
@pytest.mark.complete("curl --data @", cwd="shared/default/foo.d")
2222
def test_data_atfile(self, completion):
23-
assert completion == "foo"
23+
assert "@foo" in completion
24+
assert "@-" in completion
2425

2526
@pytest.mark.complete("curl --data @foo.", cwd="shared/default")
2627
def test_data_atfile_dir(self, completion):

0 commit comments

Comments
 (0)