sampsyo/beets — pull request #433 by pedros (2013-10-22 17:56:57+00:00)
Title: Add vararg_callback utility function to beets.ui

@sampsyo: I'd like you to review this before I merge. I'd rather not change core files without your input.

Optparse doesn't support argparse nargs='+' style arguments. This patch
adds a callback utility function that allows that idiom. The function is
taken from the page at
http://docs.python.org/2/library/optparse.html#callback-example-6-variable-arguments.

Here's an example of how to use it:

from beets.ui import vararg_callback
parser.add_option("-c", "--callback", dest="vararg_attr",
action="callback", callback=vararg_callback)