Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bash completions #153

Merged
merged 5 commits into from
Oct 22, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
58 changes: 58 additions & 0 deletions completions/completions.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/usr/bin/env bash

_playerctl_completions() {
local cur="${COMP_WORDS[$COMP_CWORD]}"
local prev="${COMP_WORDS[$COMP_CWORD - 1]}"
local root_words="
play
pause
play-pause
stop
next
previous
position
volume
status
metadata
open
loop
shuffle
-h --help
-p --player=
-a --all-players
-i --ignore-player=
-f --format
-F --follow
-l --list-all
-v --version"

case $prev in
loop)
COMPREPLY=($(compgen -W "none track playlist" -- "$cur"))
return 0
;;
shuffle)
COMPREPLY=($(compgen -W "on off" -- "$cur"))
return 0
;;
-p|--player=|-i|--ignore-player=)
# TODO list supported players here?
MarkusG marked this conversation as resolved.
Show resolved Hide resolved
COMPREPLY=()
return 0
;;
-f|--format)
COMPREPLY=()
return 0
;;
position|volume|metadata|open)
MarkusG marked this conversation as resolved.
Show resolved Hide resolved
COMPREPLY=()
return 0
;;
*)
COMPREPLY=($(compgen -W "$root_words" -- "$cur"))
return 0
;;
esac
}

complete -F _playerctl_completions playerctl