Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Dynamic completion question



I'm working on adding the ability to handle FLAC tags dynamically with the completion I wrote; I've got something that *mostly* works.

function _metaflac_tags () {
    local foo bar
foo=$(metaflac $line[1] --export-tags-to=-) #Gets a list of the tags (and their values) bar=("${(@)${(f)foo}%[=]*}") #Cuts the list into an array just of the tag names (what I want)
    compadd -a bar -X "Existing tags"
}

This is called from:

_arguments '--show-tag=:FLAC tags:_metaflac_tags'

My questions are, first, is this the right way to do this? Should I use some utility function instead? (maybe _alternatives or something?)

Second, assuming this *is* the right way to do this, how do I get a neat looking description line, like I get for all the other argument completions? I assume I'm pre-empting it with my call to compadd, somehow, but I don't understand how this is happening.

Suggestions greatly appreciated!

Jesse Weinstein



Messages sorted by: Reverse Date, Date, Thread, Author