Skip to content

Commit 6e1ec09

Browse files
committed
fix(reportbug): handle the case of prev=-oOPTARG
1 parent dd880e3 commit 6e1ec09

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

completions/reportbug

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

8+
local noargopts='!(-*|*[CefKHPsoiATjVuQtBS]*)'
9+
# shellcheck disable=SC2254
810
case $prev in
911
--class | --header | --pseudo-header | --mirror | --list-cc | \
1012
--subject | --http_proxy | --proxy | --email | --realname | \
1113
--smtpuser | --smtppasswd | --replyto | --reply-to | \
1214
--justification | --package-version | --body | --body-file | \
1315
--timeout | --max-attachment-size | --envelope-from | \
14-
-!(-*)[CHPsjV])
16+
-${noargopts}[CHPsjV])
1517
return
1618
;;
1719
--filename | --include | --mta | --output | --attach | -[fioA])
1820
_filedir
1921
return
2022
;;
21-
--keyid | -!(-*)K)
23+
--keyid | -${noargopts}K)
2224
COMPREPLY=($(compgen -W '$(IFS=: ; \
2325
gpg --list-keys --with-colons 2>/dev/null \
2426
| while read -ra row ; do
@@ -27,15 +29,15 @@ _reportbug()
2729
done)' -- "$cur"))
2830
return
2931
;;
30-
--tag | --ui | --interface | --type | --bts | --severity | --mode | -!(-*)[TutBS])
32+
--tag | --ui | --interface | --type | --bts | --severity | --mode | -${noargopts}[TutBS])
3133
COMPREPLY+=($(
3234
compgen -W \
33-
'$("$1" $prev help 2>&1 </dev/null | sed -ne "/^[[:space:]]/p")' \
35+
'$("$1" $prev help 2>&1 | sed -ne "/^[[:space:]]/p")' \
3436
-- "$cur"
3537
))
3638
return
3739
;;
38-
--editor | --mua | --mbox-reader-cmd | -!(-*)e)
40+
--editor | --mua | --mbox-reader-cmd | -${noargopts}e)
3941
compopt -o filenames
4042
COMPREPLY=($(compgen -c -- "$cur"))
4143
return

0 commit comments

Comments
 (0)