Skip to content

Commit 9fb0216

Browse files
authored
Merge pull request #1347 from zappolowski/fix-bash-completion
Fix bash completion
2 parents f556044 + 9843725 commit 9fb0216

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

completions/dunst.bashcomp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ _dunst() {
55
opts='-v -version --version -verbosity -conf -config -print --print -startup_notification --startup_notification -h -help --help'
66

77
case "$prev" in
8-
-verbosity) COMPREPLY=("crit" "warn" "mesg" "info" "debug")
8+
-verbosity) COMPREPLY=( $( compgen -W 'crit warn mesg info debug' -- "$cur") )
99
return ;;
1010
-conf|--config) _filedir
1111
return ;;

completions/dunstctl.bashcomp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
11
_dunstctl() {
2-
local opts cur prev split=false
2+
local opts cur prev
33
_get_comp_words_by_ref cur prev
44
COMPREPLY=()
55
opts='action close close-all context count debug help history history-clear history-pop history-rm is-paused rule rules set-paused'
66

77
case "$prev" in
8-
count) COMPREPLY=('displayed' 'history' 'waiting')
8+
count) COMPREPLY=( $( compgen -W 'displayed history waiting' -- "$cur" ) )
99
return ;;
10-
set-paused) COMPREPLY=('true' 'false' 'toggle')
10+
set-paused) COMPREPLY=( $( compgen -W 'true false toggle' -- "$cur" ) )
1111
return ;;
1212
history-pop|history-rm)
13-
COMPREPLY=( $(dunstctl history | grep -A2 '"id" :' |
14-
awk '/"data" :/{print $3}' | sort -u) )
13+
COMPREPLY=( $( compgen -W "$(dunstctl history | jq -r '.data[][].id.data')" -- "$cur" ) )
1514
return ;;
1615
rule)
17-
COMPREPLY=( $( compgen -W "$(dunstctl rules --json | jq -r '.data[][].name.data')" -- $cur ) )
16+
COMPREPLY=( $( compgen -W "$(dunstctl rules --json | jq -r '.data[][].name.data')" -- "$cur" ) )
1817
return ;;
1918
rules)
20-
COMPREPLY=( $( compgen -W "--json" ) )
19+
COMPREPLY=( $( compgen -W "--json" -- "$cur" ) )
2120
return ;;
2221
esac
2322

2423
case "${COMP_WORDS[1]}" in
25-
rule) COMPREPLY=('enabled' 'disable' 'toggle')
24+
rule) COMPREPLY=( $( compgen -W 'enable disable toggle' -- "$cur" ) )
2625
return ;;
2726
esac
2827

0 commit comments

Comments
 (0)