Skip to content

Commit

Permalink
Merge pull request #1347 from zappolowski/fix-bash-completion
Browse files Browse the repository at this point in the history
Fix bash completion
  • Loading branch information
zappolowski authored May 1, 2024
2 parents f556044 + 9843725 commit 9fb0216
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion completions/dunst.bashcomp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ _dunst() {
opts='-v -version --version -verbosity -conf -config -print --print -startup_notification --startup_notification -h -help --help'

case "$prev" in
-verbosity) COMPREPLY=("crit" "warn" "mesg" "info" "debug")
-verbosity) COMPREPLY=( $( compgen -W 'crit warn mesg info debug' -- "$cur") )
return ;;
-conf|--config) _filedir
return ;;
Expand Down
15 changes: 7 additions & 8 deletions completions/dunstctl.bashcomp
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
_dunstctl() {
local opts cur prev split=false
local opts cur prev
_get_comp_words_by_ref cur prev
COMPREPLY=()
opts='action close close-all context count debug help history history-clear history-pop history-rm is-paused rule rules set-paused'

case "$prev" in
count) COMPREPLY=('displayed' 'history' 'waiting')
count) COMPREPLY=( $( compgen -W 'displayed history waiting' -- "$cur" ) )
return ;;
set-paused) COMPREPLY=('true' 'false' 'toggle')
set-paused) COMPREPLY=( $( compgen -W 'true false toggle' -- "$cur" ) )
return ;;
history-pop|history-rm)
COMPREPLY=( $(dunstctl history | grep -A2 '"id" :' |
awk '/"data" :/{print $3}' | sort -u) )
COMPREPLY=( $( compgen -W "$(dunstctl history | jq -r '.data[][].id.data')" -- "$cur" ) )
return ;;
rule)
COMPREPLY=( $( compgen -W "$(dunstctl rules --json | jq -r '.data[][].name.data')" -- $cur ) )
COMPREPLY=( $( compgen -W "$(dunstctl rules --json | jq -r '.data[][].name.data')" -- "$cur" ) )
return ;;
rules)
COMPREPLY=( $( compgen -W "--json" ) )
COMPREPLY=( $( compgen -W "--json" -- "$cur" ) )
return ;;
esac

case "${COMP_WORDS[1]}" in
rule) COMPREPLY=('enabled' 'disable' 'toggle')
rule) COMPREPLY=( $( compgen -W 'enable disable toggle' -- "$cur" ) )
return ;;
esac

Expand Down

0 comments on commit 9fb0216

Please sign in to comment.