Skip to content

Commit a392580

Browse files
authored
Merge pull request #862 from akinomyoga/reportbug-otherflags
fix(completions/*): skip `prev` of the form `-oOPTARG`
2 parents dd880e3 + ab7c0b4 commit a392580

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+840
-520
lines changed

completions/a2x

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@ _a2x()
55
local cur prev words cword split comp_args
66
_comp_initialize -s -- "$@" || return
77

8+
local noargopts='!(-*|*[aDd]*)'
9+
# shellcheck disable=SC2254
810
case $prev in
911
--attribute | --asciidoc-opts | --dblatex-opts | --fop-opts | --help | \
10-
--version | --xsltproc-opts | -!(-*)[ah])
12+
--version | --xsltproc-opts | -${noargopts}[ah])
1113
return
1214
;;
13-
--destination-dir | --icons-dir | -!(-*)D)
15+
--destination-dir | --icons-dir | -${noargopts}D)
1416
_filedir -d
1517
return
1618
;;
17-
--doctype | -!(-*)d)
19+
--doctype | -${noargopts}d)
1820
_comp_xfunc asciidoc doctype
1921
return
2022
;;

completions/acpi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ _acpi()
55
local cur prev words cword comp_args
66
_comp_initialize -- "$@" || return
77

8+
local noargopts='!(-*|*[d]*)'
9+
# shellcheck disable=SC2254
810
case $prev in
9-
--help | --version | -!(-*)[hv])
11+
--help | --version | -${noargopts}[hv])
1012
return
1113
;;
12-
--directory | -!(-*)d)
14+
--directory | -${noargopts}d)
1315
_filedir -d
1416
return
1517
;;

completions/apt-cache

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@ _apt_cache()
5656
return
5757
fi
5858

59+
local noargopts='!(-*|*[cps]*)'
60+
# shellcheck disable=SC2254
5961
case $prev in
60-
--config-file | --pkg-cache | --src-cache | -!(-*)[cps])
62+
--config-file | --pkg-cache | --src-cache | -${noargopts}[cps])
6163
_filedir
6264
return
6365
;;

completions/apt-get

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,17 @@ _apt_get()
6767
return
6868
fi
6969

70+
local noargopts='!(-*|*[eoct]*)'
71+
# shellcheck disable=SC2254
7072
case $prev in
71-
--error-on | --help | --version | --option | -!(-*)[ehvo])
73+
--error-on | --help | --version | --option | -${noargopts}[ehvo])
7274
return
7375
;;
74-
--config-file | -!(-*)c)
76+
--config-file | -${noargopts}c)
7577
_filedir
7678
return
7779
;;
78-
--target-release | --default-release | -!(-*)t)
80+
--target-release | --default-release | -${noargopts}t)
7981
COMPREPLY=($(compgen -W "$(apt-cache policy | command sed -ne \
8082
's/^ *release.*[ ,]o=\(Debian\|Ubuntu\),a=\(\w*\).*/\2/p')" \
8183
-- "$cur"))

completions/apt-mark

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,17 @@ _comp_cmd_apt_mark()
3333
return
3434
fi
3535

36+
local noargopts='!(-*|*[ocf]*)'
37+
# shellcheck disable=SC2254
3638
case $prev in
37-
--help | --version | --option | -!(-*)[hvo])
39+
--help | --version | --option | -${noargopts}[hvo])
3840
return
3941
;;
40-
--config-file | -!(-*)c)
42+
--config-file | -${noargopts}c)
4143
_filedir conf
4244
return
4345
;;
44-
--file | -!(-*)f)
46+
--file | -${noargopts}f)
4547
_filedir
4648
return
4749
;;

completions/aptitude

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,26 @@ _aptitude()
4646
esac
4747
fi
4848

49+
local noargopts='!(-*|*[SwFoOt]*)'
50+
# shellcheck disable=SC2254
4951
case $prev in
5052
# don't complete anything if these options are found
5153
autoclean | clean | forget-new | search | upgrade | update | keep-all)
5254
return
5355
;;
54-
-!(-*)S)
56+
-${noargopts}S)
5557
_filedir
5658
return
5759
;;
58-
--display-format | --width | -!(-*)[wFo])
60+
--display-format | --width | -${noargopts}[wFo])
5961
return
6062
;;
61-
--sort | -!(-*)O)
63+
--sort | -${noargopts}O)
6264
COMPREPLY=($(compgen -W 'installsize installsizechange debsize
6365
name priority version' -- "$cur"))
6466
return
6567
;;
66-
--target-release | --default-release | -!(-*)t)
68+
--target-release | --default-release | -${noargopts}t)
6769
COMPREPLY=($(apt-cache policy |
6870
command grep "release.o=Debian,a=$cur" |
6971
command sed -e "s/.*a=\(\w*\).*/\1/" | uniq 2>/dev/null))

completions/arp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,22 @@ _arp()
55
local cur prev words cword comp_args
66
_comp_initialize -- "$@" || return
77

8+
local noargopts='!(-*|*[iApfHt]*)'
9+
# shellcheck disable=SC2254
810
case $prev in
9-
--device | -!(-*)i)
11+
--device | -${noargopts}i)
1012
_available_interfaces -a
1113
return
1214
;;
13-
--protocol | -!(-*)[Ap])
15+
--protocol | -${noargopts}[Ap])
1416
# TODO protocol/address family
1517
return
1618
;;
17-
--file | -!(-*)f)
19+
--file | -${noargopts}f)
1820
_filedir
1921
return
2022
;;
21-
--hw-type | -!(-*)[Ht])
23+
--hw-type | -${noargopts}[Ht])
2224
# TODO: parse from --help output?
2325
COMPREPLY=($(compgen -W 'ash ether ax25 netrom rose arcnet \
2426
dlci fddi hippi irda x25 eui64' -- "$cur"))
@@ -34,7 +36,7 @@ _arp()
3436
fi
3537

3638
local args
37-
_count_args "" "@(--device|--protocol|--file|--hw-type|-!(-*)[iApfHt])"
39+
_count_args "" "@(--device|--protocol|--file|--hw-type|-${noargopts}[iApfHt])"
3840
case $args in
3941
1)
4042
local ips=$("$1" -an | command sed -ne \

completions/asciidoc

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,29 @@ _asciidoc()
1212
local cur prev words cword split comp_args
1313
_comp_initialize -s -- "$@" || return
1414

15+
local noargopts='!(-*|*[abfdo]*)'
16+
# shellcheck disable=SC2254
1517
case $prev in
16-
--attribute | -!(-*)a)
18+
--attribute | -${noargopts}a)
1719
return
1820
;;
19-
--backend | -!(-*)b)
21+
--backend | -${noargopts}b)
2022
COMPREPLY=($(compgen -W 'docbook html4 xhtml11' -- "$cur"))
2123
return
2224
;;
23-
--conf-file | -!(-*)f)
25+
--conf-file | -${noargopts}f)
2426
_filedir conf
2527
return
2628
;;
27-
--doctype | -!(-*)d)
29+
--doctype | -${noargopts}d)
2830
_comp_xfunc_asciidoc_doctype
2931
return
3032
;;
31-
--help | -!(-*)h)
33+
--help | -${noargopts}h)
3234
COMPREPLY=($(compgen -W 'manpage syntax topics' -- "$cur"))
3335
return
3436
;;
35-
--out-file | -!(-*)o)
37+
--out-file | -${noargopts}o)
3638
_filedir
3739
return
3840
;;

completions/autoscan

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ _autoscan()
55
local cur prev words cword split comp_args
66
_comp_initialize -s -- "$@" || return
77

8+
local noargopts='!(-*|*[BI]*)'
9+
# shellcheck disable=SC2254
810
case "$prev" in
9-
--help | --version | -!(-*)[hV])
11+
--help | --version | -${noargopts}[hV])
1012
return
1113
;;
12-
--prepend-include | --include | -!(-*)[BI])
14+
--prepend-include | --include | -${noargopts}[BI])
1315
_filedir -d
1416
return
1517
;;

completions/avahi-browse

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ _comp_cmd_avahi_browse()
55
local cur prev words cword split comp_args
66
_comp_initialize -s -- "$@" || return
77

8+
local noargopts='!(-*|*[D]*)'
9+
# shellcheck disable=SC2254
810
case $prev in
9-
--domain | -!(-*)D)
11+
--domain | -${noargopts}D)
1012
return
1113
;;
12-
--help | --version | -!(-*)[hV]*)
14+
--help | --version | -${noargopts}[hV]*)
1315
return
1416
;;
1517
esac
@@ -27,7 +29,7 @@ _comp_cmd_avahi_browse()
2729
local word
2830
for word in "${words[@]}"; do
2931
case $word in
30-
--all | --browse-domains | --dump-db | -!(-*)[aDb]*)
32+
--all | --browse-domains | --dump-db | -${noargopts}[aDb]*)
3133
return
3234
;;
3335
esac

0 commit comments

Comments
 (0)