File tree 10 files changed +25
-24
lines changed
10 files changed +25
-24
lines changed Original file line number Diff line number Diff line change @@ -1751,10 +1751,11 @@ _expand()
1751
1751
;;
1752
1752
~ * )
1753
1753
_comp_compgen -v COMPREPLY tilde &&
1754
- eval " COMPREPLY[0]=$( printf ~ %q " ${COMPREPLY[0]# \~ } " ) "
1755
- return ${ # COMPREPLY[@]}
1754
+ eval " COMPREPLY[0]=$( printf ~ %q " ${COMPREPLY[0]# \~ } " ) " &&
1755
+ return 1
1756
1756
;;
1757
1757
esac
1758
+ return 0
1758
1759
}
1759
1760
1760
1761
# Process ID related functions.
@@ -2722,7 +2723,7 @@ complete -F _comp_command aoss command "do" else eval exec ltrace nice nohup pad
2722
2723
_comp_root_command ()
2723
2724
{
2724
2725
local PATH=$PATH :/sbin:/usr/sbin:/usr/local/sbin
2725
- local root_command =$1
2726
+ local _comp_root_command =$1
2726
2727
_comp_command
2727
2728
}
2728
2729
complete -F _comp_root_command fakeroot gksu gksudo kdesudo really
@@ -2732,7 +2733,7 @@ complete -F _comp_root_command fakeroot gksu gksudo kdesudo really
2732
2733
# @since 2.12
2733
2734
_comp_as_root ()
2734
2735
{
2735
- [[ $EUID -eq 0 || ${root_command -} ]]
2736
+ [[ $EUID -eq 0 || ${_comp_root_command -} ]]
2736
2737
}
2737
2738
2738
2739
# Complete on available commands, subject to `no_empty_cmd_completion`.
@@ -2821,7 +2822,7 @@ _filedir_xspec()
2821
2822
_comp_quote_compgen " $cur "
2822
2823
local quoted=$ret
2823
2824
2824
- local xspec=${_xspecs[${1##*/}]} tmp
2825
+ local xspec=${_xspecs[${1##*/}]}
2825
2826
local -a toks
2826
2827
_comp_compgen -v toks -c " $quoted " -- -d
2827
2828
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ _comp_cmd_slackpkg()
51
51
. " $config "
52
52
53
53
local i action
54
- for (( i = 1 ; i < ${ # words[@]} ; i++ )) ; do
54
+ for (( i = 1 ; i < cword ; i++ )) ; do
55
55
if [[ ${words[i]} != -* ]]; then
56
56
action=" ${words[i]} "
57
57
break
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ _comp_cmd_getent()
6
6
_comp_initialize -s -- " $@ " || return
7
7
8
8
local noargopts=' !(-*|*[s]*)'
9
- local i db has_db=" "
9
+ local i db= " " has_db=" "
10
10
for (( i = 1 ; i < cword; i++ )) ; do
11
11
# shellcheck disable=SC2254
12
12
case ${words[i]} in
@@ -27,7 +27,7 @@ _comp_cmd_getent()
27
27
esac
28
28
done
29
29
30
- case ${db-} in
30
+ case $db in
31
31
passwd)
32
32
_comp_compgen -- -u
33
33
return
@@ -57,8 +57,9 @@ _comp_cmd_getent()
57
57
;;
58
58
esac
59
59
60
+ # shellcheck disable=SC2254
60
61
case $prev in
61
- -s | --service)
62
+ -${noargopts} s | --service)
62
63
return
63
64
;;
64
65
esac
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ _comp_cmd_sbopkg()
36
36
37
37
local i config
38
38
config=" /etc/sbopkg/sbopkg.conf"
39
- for (( i = ${# words[@]} - 1 ; i > 0 ; i-- )) ; do
39
+ for (( i = ${# words[@]} - 2 ; i > 0 ; i-- )) ; do
40
40
if [[ ${words[i]} == -f ]]; then
41
41
config=" ${words[i + 1]} "
42
42
__expand_tilde_by_ref config
@@ -47,7 +47,7 @@ _comp_cmd_sbopkg()
47
47
[[ -r $config ]] || return
48
48
. " $config "
49
49
50
- for (( i = 1 ; i < ${# words[@]} ; i++ )) ; do
50
+ for (( i = 1 ; i < ${# words[@]} - 1 ; i++ )) ; do
51
51
case " ${words[i]} " in
52
52
-V)
53
53
REPO_NAME=" ${words[i + 1]%%/* } "
@@ -58,11 +58,12 @@ _comp_cmd_sbopkg()
58
58
;;
59
59
esac
60
60
done
61
- [[ -r $REPO_ROOT /$REPO_NAME /$REPO_BRANCH /SLACKBUILDS.TXT ]] || return
61
+ local file=${REPO_ROOT-} /${REPO_NAME-} /${REPO_BRANCH-} /SLACKBUILDS.TXT
62
+ [[ -r $file ]] || return
62
63
63
64
COMPREPLY=($(
64
65
command sed -ne " /^SLACKBUILD NAME: $cur /{s/^SLACKBUILD NAME: //;p}" \
65
- " $REPO_ROOT / $REPO_NAME / $REPO_BRANCH /SLACKBUILDS.TXT "
66
+ " $file "
66
67
) )
67
68
_comp_compgen -aC " $QUEUEDIR " -- -f -X " !*.sqf"
68
69
} &&
Original file line number Diff line number Diff line change @@ -378,7 +378,7 @@ _comp_cmd_ssh()
378
378
_count_args " =" " -*[BbcDeLpRWEFSIiJlmOoQw]"
379
379
if (( args > 1 )) ; then
380
380
compopt -o filenames
381
- _comp_compgen -a commands
381
+ _comp_compgen_commands
382
382
else
383
383
_known_hosts_real ${ipvx-} -a ${configfile: +-F " $configfile " } \
384
384
-- " $cur "
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ _comp_cmd_sudo()
13
13
for (( i = 1 ; i <= cword; i++ )) ; do
14
14
if [[ ${words[i]} != -* ]]; then
15
15
local PATH=$PATH :/sbin:/usr/sbin:/usr/local/sbin
16
- local root_command= ${words[i]}
16
+ local _comp_root_command= $1
17
17
_comp_command_offset $i
18
18
return
19
19
fi
Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ _comp_cmd_svcadm()
108
108
for (( i = 1 ; i < cword; i++ )) ; do
109
109
if [[ ${words[i]} == @ (enable| disable| restart| refresh| clear| mark| milestone) ]]; then
110
110
command=${words[i]}
111
+ break
111
112
fi
112
113
done
113
114
Original file line number Diff line number Diff line change 2
2
3
3
_comp_cmd_timeout ()
4
4
{
5
- local cur prev words cword was_split comp_args i found= " "
5
+ local cur prev words cword was_split comp_args i
6
6
_comp_initialize -s -- " $@ " || return
7
7
8
8
local noargopts=' !(-*|*[ks]*)'
9
- for (( i = 1 ; i <= cword; i++ )) ; do
9
+ for (( i = 1 ; i < cword; i++ )) ; do
10
10
if [[ ${words[i]} != -* ]]; then
11
- if [[ $found ]]; then
12
- _comp_command_offset $i
13
- return
14
- fi
15
- found=set
11
+ _comp_command_offset " $(( i + 1 )) "
12
+ return
16
13
fi
17
14
# shellcheck disable=SC2254
18
15
[[ ${words[i]} == -@ (-kill-after| -signal| ${noargopts} [ks]) ]] && (( i++ ))
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ _comp_cmd_update_alternatives()
31
31
;;
32
32
esac
33
33
34
- local mode args i
34
+ local mode= " " args i
35
35
36
36
# find which mode to use and how many real args used so far
37
37
for (( i = 1 ; i < cword; i++ )) ; do
Original file line number Diff line number Diff line change 8
8
@pytest .mark .bashcomp (
9
9
pre_cmds = (
10
10
# Fake root command to get all users/groups completed at least for now
11
- "root_command =sudo" ,
11
+ "_comp_root_command =sudo" ,
12
12
)
13
13
)
14
14
class TestChown :
You can’t perform that action at this time.
0 commit comments