Skip to content

Commit ecf6f41

Browse files
committed
fix(ulimit): complete limits only after option that takes one
1 parent c18756c commit ecf6f41

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

completions/ulimit

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,7 @@ _ulimit()
3232
fi
3333
fi
3434

35-
[[ $prev == -[SH] ]] && return
36-
37-
local args
38-
_count_args
39-
((args == 1)) &&
40-
COMPREPLY=($(compgen -W "soft hard unlimited" -- "$cur"))
35+
[[ ${mode-} ]] && COMPREPLY=($(compgen -W "soft hard unlimited" -- "$cur"))
4136
} &&
4237
complete -F _ulimit ulimit
4338

test/t/test_ulimit.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class TestUlimit:
77
@pytest.mark.complete("ulimit ")
88
def test_1(self, completion):
9-
assert completion
9+
assert not completion
1010

1111
@pytest.mark.complete("ulimit -", require_cmd=True)
1212
def test_2(self, completion):
@@ -40,3 +40,8 @@ def test_7(self, completion):
4040
def test_no_special_values_after_soft_or_hard(self, bash, flag):
4141
completion = assert_complete(bash, "ulimit %s " % flag)
4242
assert not completion
43+
44+
@pytest.mark.complete("ulimit -c 0 -n ")
45+
def test_special_not_just_first(self, completion):
46+
"""Test we offer limit values not only for the first option."""
47+
assert completion

0 commit comments

Comments
 (0)