Skip to content

Commit

Permalink
feat(curl): Complete stdin "-" in file locations
Browse files Browse the repository at this point in the history
All of the --data* and --*header options allow specifying "@-" to
signify reading from stdin
  • Loading branch information
yedayak committed Aug 4, 2024
1 parent 2dab633 commit 9c72cf8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions completions/curl
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ _comp_cmd_curl()
--proxy-header | -${noargopts}[dH])
if [[ $cur == \@* ]]; then
_comp_compgen -c "${cur:1}" filedir
_comp_compgen -a -c "${cur:1}" -- -W '-'
if [[ ${#COMPREPLY[@]} -eq 1 && -d ${COMPREPLY[0]} ]]; then
COMPREPLY[0]+=/
compopt -o nospace
Expand Down
3 changes: 2 additions & 1 deletion test/t/test_curl.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def test_4(self, completion):

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

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

0 comments on commit 9c72cf8

Please sign in to comment.