Skip to content

Commit 9c72cf8

Browse files
committed
feat(curl): Complete stdin "-" in file locations
All of the --data* and --*header options allow specifying "@-" to signify reading from stdin
1 parent 2dab633 commit 9c72cf8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

completions/curl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ _comp_cmd_curl()
5454
--proxy-header | -${noargopts}[dH])
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)