File: playerctl.bash

package info (click to toggle)
playerctl 2.4.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 704 kB
  • sloc: ansic: 5,157; python: 1,107; xml: 198; sh: 133; makefile: 62
file content (59 lines) | stat: -rw-r--r-- 977 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
_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 toggle" -- "$cur"))
			return 0
			;;
		-p|--player=|-i|--ignore-player=)
			COMPREPLY=($(compgen -W "$(playerctl --list-all)" -- "$cur"))
			return 0
			;;
		-f|--format)
			COMPREPLY=()
			return 0
			;;
		open)
			compopt -o default
			COMPREPLY=()
			;;
		position|volume|metadata)
			COMPREPLY=()
			return 0
			;;
		*)
			COMPREPLY=($(compgen -W "$root_words" -- "$cur"))
			return 0
			;;
	esac
}

complete -F _playerctl_completions playerctl