zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: metaflac completion
@ 2006-07-17 22:26 Jesse W
  0 siblings, 0 replies; only message in thread
From: Jesse W @ 2006-07-17 22:26 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 943 bytes --]

I've written a first version of a z shell completion function for the 
FLAC metadata editing program, metaflac; right now it doesn't complete 
any of the option arguments that arn't files, but it handles the 
various options, and handles looking only for FLAC files (with the -g 
option of _files).  This will be more or less my first zsh completion 
function, so any suggestions would be greatly appreciated.

I plan to implement completion for the tag options, so that, i.e. 
`metaflac foo.flac --show-tag=` would automatically get a list of the 
tags in the file in the background and complete their names at that 
point; also, I'd hope the --set-tag= option would have a preset range 
of tags to set.

My eventual goal is to make metaflac (with zsh completion) into a 
more-or-less comfortable FLAC metadata editor.

The file is attached.  If the mailing system mucks it up, it's also 
available at
http://netwood.net/usr/jessw/_metaflac


[-- Attachment #2: _metaflac --]
[-- Type: application/octet-stream, Size: 1670 bytes --]

#compdef metaflac

#Written by Jesse Weinstein <jessw@netwood.net>, Mon Jul 17 15:17:12 2006
#Version 0.3 - doesn't handle non-file option arguments yet.
#Released under the MIT license (or any compatible free-content license)
#i.e. do whatever you like with it, but credit me.

local _metaflac_opts _metaflac_shorts _metaflac_opers
typeset -A opt_args
function _metaflac_tags () {
    echo "\n\nBEEP - $line - BEEP\n\n"
}
_metaflac_opts=( 
    '--preserve-modtime' 
    '--with-filename[prefix output with filename]' 
    '--no-filename' 
    '--dont-use-padding[always rewrite the file]' 
)
_metaflac_shorts=(
    '--show-md5sum'
    '--show-min-blocksize'
    '--show-max-blocksize'
    '--show-min-framesize'
    '--show-max-framesize'
    '--show-sample-rate'
    '--show-channels'
    '--show-bps'
    '--show-total-samples'
    '--show-vendor-tag'
    '--show-tag=:FLAC tags:_metaflac_tags'
    '--remove-tag=:FLAC tags: '
    '--remove-first-tag=:FLAC tags: '
    '--remove-all-tags'
    '--set-tag=:FLAC tag and value: '
    '--import-tags-from=:flat file:_files'
    '--export-tags-to=:new file: '
    '--import-cuesheet-from=:file:_files'
    '--export-cuesheet-to=:new file: '
    '--add-replay-gain'
    '--add-seekpoint=:: '
    '--add-padding=length'

)
_metaflac_opers=(
    '--block-number=:: '
    '--block-type=:: '
    '--except-block-type=:: '
    '--application-data-format=:: '
    '--remove'
    '--remove-all'
    '--merge-padding'
    '--sort-padding'
)

_arguments "$_metaflac_opts[@]" \
    "*:FLAC file:_files -g \*.flac" \
    - "shortcuts" \
    "$_metaflac_shorts[@]" \
    - "(operations)" \
    "$_metaflac_opers[@]" \
    && return 0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-07-17 22:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-17 22:26 PATCH: metaflac completion Jesse W

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).