Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Completion nyxmms2
- X-seq: zsh-users 15561
- From: Eike von Seggern <eikevons@xxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Completion nyxmms2
- Date: Sun, 21 Nov 2010 15:56:24 +0100
- In-reply-to: <101120115618.ZM6420@xxxxxxxxxxxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mail-followup-to: zsh-users@xxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <AANLkTinqV-wktQwtAQfNZcu9CS9TAxjkXtTnhQcV-6rA@xxxxxxxxxxxxxx> <101120115618.ZM6420@xxxxxxxxxxxxxxxxxxxxxx>
On Sat, Nov 20, 2010 at 11:56 -0800, Bart Schaefer wrote:
> On Nov 20, 6:05pm, Michel wrote:
>} Subject: Completion nyxmms2
>}
>} Hello everybody !
>}
>} I use xmms2 with nyxmms2 to listen my songs but I don't have the
>} completion with nyxmms2.
>} Exist a file for the completion of nyxmms2 ?
>
> http://www.mail-archive.com/xmms2-devel@xxxxxxxxxxxxx/msg02017.html
>
> That thread mentions sending us the completions to include with zsh,
> but I don't think that ever happened.
Hi,
attached is the _nyxmms2 file that I use. I don't remember where I got
it from. Probably from the xmms2 web site. I haven't updated it
recently, but it works well with Dr.No for me.
tschuess
eike
#compdef nyxmms2
_nyxmms2_command() {
local nyxmms2_cmds
nyxmms2_cmds=(
add:"add the matching media or files to a playlist"
addpls:"add a playlist file"
scap:"stop, clear playlist, add arguments and start playing"
list:"lists the playlist"
search:"Search and print all media matching the pattern"
remove:"remove the matching media from a playlist"
clear:"clears the playlist"
play:"starts playback"
pause:"pause playback"
stop:"stops playback"
toggle:"toggles playback status between play/pause"
seek:"seek to a specific place in current song"
next:"play next song"
prev:"play previous song"
jump:"take a leap in the playlist"
move:"move a entry in the playlist"
collection:"collection manipulation - type 'nyxmms2 help collection' for more extensive help"
playlist:"playlist manipulation - type 'nyxmms2 help playlist' for more
extensive help"
server:"server manipulation - type 'nyxmms2 help server' for more extensive help"
status:"display playback status, either continuously or once"
info:"display all the properties for all media matching the pattern"
help:"print help about a command"
)
if (( CURRENT == 1 )); then
_describe -t command "nyxmms2 commands" nyxmms2_cmds
else
local curcontext="$curcontext"
fi
local cmd=$words[1]
local curcontext="${curcontext%:*}:nyxmms2-${cmd}"
_call_function ret _nyxmms2_$cmd
}
_nyxmms2_jump() {
songlist=(${"$(nyxmms2 list)"})
playlistitems=()
for song ($songlist); do
if [[ $song = (#b)' '\[(<->)/(<->)\]' '(*)' '\((*)\) ]]; then
playlistitems+=("$match[1][$match[3]]")
fi
done
_values -s ' ' 'playlist items' ${(On)playlistitems}
}
_nyxmms2_playlist() {
local playlist_cmds
playlist_cmds=(
list:"list all playlists"
switch:"change the active playlist"
create:"create a new playlist"
rename:"rename a playlist"
remove:"remove the given playlist"
clear:"clear a playlist, by default, clear the active playlist"
shuffle:"shuffle a playlist, by default, shuffle the active playlist"
sort:"sort a playlist, by default, sort the active playlist."
config:"configure a playlist, by default, sort the active playlist."
)
if (( CURRENT == 2 )); then
_describe -t command "nyxmms2 playlist commands" playlist_cmds
else
local curcontext="$curcontext"
fi
local cmd=$words[2]
local curcontext="${curcontext%:*}:nyxmms2-${cmd}"
_call_function ret _nyxmms2_playlist_$cmd
}
_nyxmms2_playlist_helper() {
local list
oifs="$IFS"
IFS="
list=($(nyxmms2 playlist list|sed 's/^..//'))
IFS="$oifs"
_describe -t command "nyxmms2 playlists" list
}
_nyxmms2_playlist_switch() {
_nyxmms2_playlist_helper
}
_nyxmms2_playlist_sort() {
_nyxmms2_playlist_helper
}
_nyxmms2_playlist_shuffle() {
_nyxmms2_playlist_helper
}
_nyxmms2_playlist_clear() {
_nyxmms2_playlist_helper
}
_nyxmms2_playlist_remove() {
_nyxmms2_playlist_helper
}
#FIXME: TODO rename, other sort args, config
_nyxmms2_collection() {
local collection_cmds
collection_cmds=(
list:"list all collection"
show:"display a human-readable description of a collection"
create:"create a new collection"
rename:"rename a collection"
remove:"remove a collection"
config:"get or set attributes for the given collection"
)
if (( CURRENT == 2 )); then
_describe -t command "nyxmms2 collection commands" collection_cmds
else
local curcontext="$curcontext"
fi
local cmd=$words[2]
local curcontext="${curcontext%:*}:nyxmms2-${cmd}"
_call_function ret _nyxmms2_collection_$cmd
}
_nyxmms2_collection_helper() {
local list
oifs="$IFS"
IFS="
list=($(nyxmms2 collection list|sed 's/^..//'))
IFS="$oifs"
_describe -t command "nyxmms2 playlists" list
}
_nyxmms2_collection_rename() {
_nyxmms2_collection_helper
}
_nyxmms2_collection_config() {
_nyxmms2_collection_helper
}
_nyxmms2_collection_remove() {
_nyxmms2_collection_helper
}
_nyxmms2_collection_show() {
_nyxmms2_collection_helper
}
_nyxmms2_add() {
_files
}
_nyxmms2_scap() {
_files
}
_nyxmms2() {
_arguments \
'--format[specify the format of song display]:format string' \
'--no-status[prevent printing song status on completion]' \
'*::nyxmms2 command:_nyxmms2_command'
}
_nyxmms2 "$@"
Messages sorted by:
Reverse Date,
Date,
Thread,
Author