| 1 |
#compdef cmus cmus-remote |
| 2 |
|
| 3 |
local expl cmus_commands |
| 4 |
|
| 5 |
cmus_commands=( |
| 6 |
add bind browser-up cd clear colorscheme echo factivate |
| 7 |
filter fset invert load mark player-next player-pause |
| 8 |
player-play quit refresh run save search-next search-prev |
| 9 |
seek set showbind shuffle source toggle unbind unmark view |
| 10 |
vol win-activate win-add-l win-add-p win-add-Q win-add-q |
| 11 |
win-bottom win-down win-mv-after win-mv-before win-next |
| 12 |
win-page-down win-page-up win-remove win-sel-cur |
| 13 |
win-toggle win-top win-up win-update |
| 14 |
) |
| 15 |
_cmus_volume() { |
| 16 |
local expl |
| 17 |
compset -P '[-+]' |
| 18 |
_wanted list expl volume compadd $expl - {0..100} |
| 19 |
} |
| 20 |
|
| 21 |
case $service in |
| 22 |
(cmus-remote) |
| 23 |
_arguments -C -s\ |
| 24 |
'--server[connect using socket SOCKET]:socket:_files' \ |
| 25 |
'--help[display this help and exit]:' \ |
| 26 |
'--version[Display version information and exit.]:' \ |
| 27 |
'(--play -p)'{--play,-p}'[Start playing.]:' \ |
| 28 |
'(--pause -u)'{--pause,-u}'[Toggle pause.]:' \ |
| 29 |
'(--stop -s)'{--stop,-s}'[Stop playing.]:' \ |
| 30 |
'(--next -n)'{--next,-n}'[Skip forward in playlist.]:' \ |
| 31 |
'(--prev -r)'{--prev,-r}'[Skip backward in playlist.]:' \ |
| 32 |
'(--file -f)'{--file,-f}'[Play a file.]:file:_files' \ |
| 33 |
'(--repeat -R)'{--repeat,-R}'[Toggle repeat.]:' \ |
| 34 |
'(--shuffle -S)'{--shuffle,-S}'[Toggle shuffle.]:' \ |
| 35 |
'(--volume -v)'{--volume,-V+}'[Change volume. See vol command in cmus(1).]:volume:_cmus_volume' \ |
| 36 |
'(--seek -k)'{--seek,-k+}'[Seek. See seek command in cmus(1).]:seek [+-]<num>[m/h]' \ |
| 37 |
'(--query -Q)'{--query,-Q}'[Get player status (same as -C status).]:' \ |
| 38 |
'(--library -l)'{--library,-l+}'[Modify library instead of playlist.]:playlists/files/directories/URLs:_files' \ |
| 39 |
'(--playlist -P)'{--playlist,-P}'[Modify playlist (default).]::Playlist:_files' \ |
| 40 |
'(--queue -q)'{--queue,-q}'[Modify play queue instead of playlist.]:' \ |
| 41 |
'(--clear -c)'{--clear,-c}'[Clear playlist, library (-l) or play queue (-q).]:playlist' \ |
| 42 |
'(--raw -C)'{--raw,-C+}'[Treat arguments (instead of stdin) as raw commands.]:command:(${cmus_commands[@]}):' \ |
| 43 |
;; |
| 44 |
(cmus) |
| 45 |
_arguments \ |
| 46 |
'--listen[listen on ADDR instead of $CMUS_SOCKET or $XDG_RUNTIME_DIR/cmus-socket]:socket:_files' \ |
| 47 |
'--plugins[list available plugins and exit]' \ |
| 48 |
'--help[display this help and exit]' \ |
| 49 |
'--version[display version information]' |
| 50 |
;; |
| 51 |
esac |
| 52 |
|