Skip to content

Commit dea48ff

Browse files
committed
feat(reportbug): parse various option args from option help
Closes #753
1 parent bbe2f09 commit dea48ff

File tree

2 files changed

+10
-28
lines changed

2 files changed

+10
-28
lines changed

completions/reportbug

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -27,41 +27,19 @@ _reportbug()
2727
done)' -- "$cur"))
2828
return
2929
;;
30-
--bts | -!(-*)B)
31-
COMPREPLY=($(compgen -W "debian guug kde mandrake help" -- \
32-
"$cur"))
30+
--tag | --ui | --interface | --type | --bts | --severity | --mode | -!(-*)[TutBS])
31+
COMPREPLY+=($(
32+
compgen -W \
33+
'$("$1" $prev help 2>&1 | sed -ne /^[[:space:]]/p)' \
34+
-- "$cur"
35+
))
3336
return
3437
;;
3538
--editor | --mua | --mbox-reader-cmd | -!(-*)e)
3639
compopt -o filenames
3740
COMPREPLY=($(compgen -c -- "$cur"))
3841
return
3942
;;
40-
--mode)
41-
COMPREPLY=($(compgen -W "novice standard expert" -- "$cur"))
42-
return
43-
;;
44-
--severity | -!(-*)S)
45-
COMPREPLY=($(compgen -W "grave serious important normal minor
46-
wishlist" -- "$cur"))
47-
return
48-
;;
49-
--ui | --interface | -!(-*)u)
50-
COMPREPLY=($(compgen -W "newt text gnome" -- "$cur"))
51-
return
52-
;;
53-
--type | -!(-*)t)
54-
COMPREPLY=($(compgen -W "gnats debbugs" -- "$cur"))
55-
return
56-
;;
57-
--tag | -!(-*)T)
58-
COMPREPLY=($(compgen -W "none woody potato sarge sarge-ignore
59-
etch etch-ignore lenny lenny-ignore sid experimental confirmed
60-
d-i fixed fixed-in-experimental fixed-upstream help l10n
61-
moreinfo patch pending security unreproducible upstream wontfix
62-
ipv6 lfs" -- "$cur"))
63-
return
64-
;;
6543
--from-buildd)
6644
COMPREPLY=($(compgen -S "_" -W '$(apt-cache dumpavail | \
6745
command grep "^Source: $cur" | sort -u | cut -f2 -d" ")'))

test/t/test_reportbug.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ class TestReportbug:
55
@pytest.mark.complete("reportbug --m", require_cmd=True)
66
def test_1(self, completion):
77
assert completion
8+
9+
@pytest.mark.complete("reportbug --bts=", require_cmd=True)
10+
def test_bts(self, completion):
11+
assert "default" in completion

0 commit comments

Comments
 (0)