File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,10 @@ _chmod()
17
17
18
18
$split && return
19
19
20
- if [[ $cur == -* ]]; then
20
+ # Adapted from coreutils 8.28 chmod man page
21
+ local modearg=" -@(+(*([rwxXst])|[ugo])|+([0-7]))"
22
+
23
+ if [[ $cur == -* && $cur != $modearg ]]; then
21
24
local opts=$( _parse_help " $1 " )
22
25
[[ $opts ]] || opts=$( _parse_usage " $1 " )
23
26
COMPREPLY=( $( compgen -W " $opts " -- " $cur " ) )
@@ -26,7 +29,7 @@ _chmod()
26
29
fi
27
30
28
31
local args
29
- _count_args
32
+ _count_args " " " " " $modearg "
30
33
31
34
case $args in
32
35
1) ;; # mode
Original file line number Diff line number Diff line change @@ -15,3 +15,11 @@ def test_2(self, completion):
15
15
@pytest .mark .complete ("chmod -" )
16
16
def test_3 (self , completion ):
17
17
assert completion .list
18
+
19
+ @pytest .mark .complete ("chmod -x " )
20
+ def test_4 (self , completion ):
21
+ assert completion .list
22
+
23
+ @pytest .mark .complete ("chmod -77 " )
24
+ def test_5 (self , completion ):
25
+ assert completion .list
You can’t perform that action at this time.
0 commit comments