File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,8 @@ _comp_cmd_env()
7
7
8
8
local i noargopts=' !(-*|*[uCS]*)'
9
9
for (( i = 1 ; i <= cword; i++ )) ; do
10
- if [[ ${words[i]} != -* ]]; then
10
+ if [[ ${words[i]} != -* || ${words[i]} == -? (-) && i -lt cword ]]; then
11
+ [[ ${words[i]} == -? (-) ]] && (( i++ ))
11
12
for (( ; i <= cword; i++ )) ; do
12
13
if [[ ${words[i]} != * = * ]]; then
13
14
_comp_command_offset " $i "
Original file line number Diff line number Diff line change @@ -23,12 +23,22 @@ def test_lang_envvar(self, completion):
23
23
"foo=bar" ,
24
24
"--debug" ,
25
25
"--debug foo=bar" ,
26
+ "-" ,
27
+ "- foo=bar" ,
26
28
],
27
29
)
28
30
def test_command (self , bash , opts ):
29
31
completion = assert_complete (bash , "env %s s" % opts )
30
32
assert completion == "h" or "sh" in completion
31
33
32
- @pytest .mark .complete ("env foo=bar --debug s" )
33
- def test_option_like_command_after_assignment (self , completion ):
34
+ @pytest .mark .parametrize (
35
+ "opts" ,
36
+ [
37
+ "foo=bar --non-existent" ,
38
+ "- --non-existent" ,
39
+ "-- --non-existent" ,
40
+ ],
41
+ )
42
+ def test_option_like_command (self , bash , opts ):
43
+ completion = assert_complete (bash , "env %s s" % opts )
34
44
assert not (completion == "h" or "sh" in completion )
You can’t perform that action at this time.
0 commit comments