Skip to content

Commit 24c80c9

Browse files
akinomyogascop
authored andcommitted
fix(make): handle multiple short options in skipping arguments
#898
1 parent fdf4456 commit 24c80c9

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

completions/make

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ _comp_cmd_make()
187187
# before we check for makefiles, see if a path was specified
188188
# with -C/--directory
189189
for ((i = 1; i < ${#words[@]}; i++)); do
190-
if [[ ${words[i]} == -@(C|-directory) ]]; then
190+
if [[ ${words[i]} == @(-${noargopts}C|--directory) ]]; then
191191
# Expand tilde expansion
192192
local ret
193193
_comp_dequote "${words[i + 1]-}" &&
@@ -200,7 +200,7 @@ _comp_cmd_make()
200200
# before we scan for targets, see if a Makefile name was
201201
# specified with -f/--file/--makefile
202202
for ((i = 1; i < ${#words[@]}; i++)); do
203-
if [[ ${words[i]} == -@(f|-?(make)file) ]]; then
203+
if [[ ${words[i]} == @(-${noargopts}f|--?(make)file) ]]; then
204204
# Expand tilde expansion
205205
local ret
206206
_comp_dequote "${words[i + 1]-}" &&

test/t/test_make.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ def test_8(self, bash, completion):
4444
assert completion == "all clean extra_makefile install sample".split()
4545
os.remove(f"{bash.cwd}/make/extra_makefile")
4646

47+
@pytest.mark.complete("make -nC make ", require_cmd=True)
48+
def test_8n(self, bash, completion):
49+
assert completion == "all clean extra_makefile install sample".split()
50+
os.remove(f"{bash.cwd}/make/extra_makefile")
51+
4752
@pytest.mark.complete("make -", require_cmd=True)
4853
def test_9(self, completion):
4954
assert completion

0 commit comments

Comments
 (0)