about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPaul Ackersviller <packersv@users.sourceforge.net>2007-04-12 01:23:49 +0000
committerPaul Ackersviller <packersv@users.sourceforge.net>2007-04-12 01:23:49 +0000
commit54ea74d39fe1876263f3634ff5dc6534c9725ce8 (patch)
treedfce3c7da0f760660d0533a4efd27b4d3ab02b8f
parent21f83e46b28ad9f21c8e194f545b3b3220e10e73 (diff)
downloadzsh-54ea74d39fe1876263f3634ff5dc6534c9725ce8.tar.gz
zsh-54ea74d39fe1876263f3634ff5dc6534c9725ce8.tar.xz
zsh-54ea74d39fe1876263f3634ff5dc6534c9725ce8.zip
Merge from trunk of workers/{22433,22456,22457,23089}.
-rw-r--r--Completion/Unix/Command/_mpc33
1 files changed, 28 insertions, 5 deletions
diff --git a/Completion/Unix/Command/_mpc b/Completion/Unix/Command/_mpc
index 320ce4b3a..152996458 100644
--- a/Completion/Unix/Command/_mpc
+++ b/Completion/Unix/Command/_mpc
@@ -4,15 +4,15 @@ local OUT foo MPD_MUSIC_DIR MPC_PLAYLIST_MATCHER MPC_FORMAT_STRING
 
 # set this style to whatever --format string you want to use when
 # constructing the list of playlist entries
-zstyle -s ':completion:${curcontext}:*' mpc-format-string MPC_FORMAT_STRING
+zstyle -s ":completion:${curcontext}:*" mpc-format-string MPC_FORMAT_STRING
 foo=(--format "${(q)MPC_FORMAT_STRING:-%file%}")
 
 # set this style to the music_directory of mpd to get _files based completion
 # for commands like "add"
-zstyle -s ':completion:${curcontext}:' mpd-music-directory MPD_MUSIC_DIR
+zstyle -s ":completion:${curcontext}:" mpd-music-directory MPD_MUSIC_DIR
 
 # matcher used for playlist completion
-zstyle -s ':completion:${curcontext}:' mpd-playlist-matcher \
+zstyle -s ":completion:${curcontext}:" mpd-playlist-matcher \
   MPC_PLAYLIST_MATCHER
 : ${MPC_PLAYLIST_MATCHER:='m:{a-z}={A-Z} l:|=**'}
 
@@ -26,14 +26,19 @@ _mpc_command() {
 
   mpc_cmds=(
     add:"add a song to the current playlist"
+    crop:"remove all songs except for the currently playing song"
     del:"remove a song from the current playlist"
     play:"start playing"
     next:"play the next song in the current playlist"
     prev:"play the previous song in the current playlist"
     pause:"pause the currently playing song"
+    toggle:"toggles Play/Pause, plays if stopped"
     stop:"stop the currently playing playlists"
     seek:"seek to the position specified in percent"
     clear:"clear the current playlist"
+    outputs:"show the current outputs"
+    enable:"enable a output"
+    disable:"disable a output"
     shuffle:"shuffle the current playlist"
     move:"move song in playlist"
     playlist:"print the current playlist"
@@ -49,7 +54,9 @@ _mpc_command() {
     search:"search for a song"
     crossfade:"set and display crossfade settings"
     update:"scan music directory for updates"
+    stats:"display statistics about MPD"
     version:"report version of MPD"
+    status:"display MPD status"
   )
 
   if (( CURRENT == 1 )); then
@@ -88,7 +95,7 @@ _mpc_helper_songnumbers() {
   out=("${(@f)$(_call_program song-numbers mpc $foo playlist 2>/dev/null)}")
   out=("${(@M)out[@]:#${~MATCH}}")
 
-  sn=("${(@)${(@M)out}//(#b)(#s)\#([0-9]#)*/$match[1]}")
+  sn=("${(@)${(@M)out}//(#b)(#s)(\#|[ >]#)([0-9]#)*/$match[2]}")
   list=("${(@Mr:COLUMNS-1:)out}")
 
   _wanted -V 'song numbers' expl 'song number' \
@@ -154,6 +161,13 @@ _mpc_helper_directories() {
   fi
 }
 
+(( $+functions[_mpc_helper_outputs] )) ||
+_mpc_helper_outputs() {
+  local vals outline
+  vals=(${${${${(M)${(f)"$(mpc outputs 2> /dev/null)"}:#Output * \(*\) is (en|dis)abled}##Output }%%\) is (en|dis)abled}/ \(/:})
+  _describe -t outputs output vals
+}
+
 _mpc_add() {
   _mpc_helper_files
 }
@@ -170,6 +184,14 @@ _mpc_seek() {
   _message "floating point percent value"
 }
 
+_mpc_enable() {
+  _mpc_helper_outputs
+}
+
+_mpc_disable() {
+  _mpc_helper_outputs
+}
+
 _mpc_move() {
   if (( $#words <= 3 )); then
     _mpc_helper_songnumbers
@@ -228,5 +250,6 @@ _mpc_update() {
 }
 
 _arguments \
-  '--format:format string' \
+  '--format[specify the format of song display]:format string' \
+  '--no-status[prevent printing song status on completion]' \
   '*::mpc command:_mpc_command'