Skip to content

Commit

Permalink
fix(make): handle multiple short options in skipping arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga authored and scop committed Oct 3, 2023
1 parent fdf4456 commit 24c80c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions completions/make
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ _comp_cmd_make()
# before we check for makefiles, see if a path was specified
# with -C/--directory
for ((i = 1; i < ${#words[@]}; i++)); do
if [[ ${words[i]} == -@(C|-directory) ]]; then
if [[ ${words[i]} == @(-${noargopts}C|--directory) ]]; then
# Expand tilde expansion
local ret
_comp_dequote "${words[i + 1]-}" &&
Expand All @@ -200,7 +200,7 @@ _comp_cmd_make()
# before we scan for targets, see if a Makefile name was
# specified with -f/--file/--makefile
for ((i = 1; i < ${#words[@]}; i++)); do
if [[ ${words[i]} == -@(f|-?(make)file) ]]; then
if [[ ${words[i]} == @(-${noargopts}f|--?(make)file) ]]; then
# Expand tilde expansion
local ret
_comp_dequote "${words[i + 1]-}" &&
Expand Down
5 changes: 5 additions & 0 deletions test/t/test_make.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ def test_8(self, bash, completion):
assert completion == "all clean extra_makefile install sample".split()
os.remove(f"{bash.cwd}/make/extra_makefile")

@pytest.mark.complete("make -nC make ", require_cmd=True)
def test_8n(self, bash, completion):
assert completion == "all clean extra_makefile install sample".split()
os.remove(f"{bash.cwd}/make/extra_makefile")

@pytest.mark.complete("make -", require_cmd=True)
def test_9(self, completion):
assert completion
Expand Down

0 comments on commit 24c80c9

Please sign in to comment.