mirror of
https://github.com/beetbox/beets.git
synced 2025-12-15 21:14:19 +01:00
Add docstring to new varargs callback ui function
This commit is contained in:
parent
7299ed24c6
commit
48b963a66e
1 changed files with 12 additions and 4 deletions
|
|
@ -695,11 +695,19 @@ class SubcommandsOptionParser(optparse.OptionParser):
|
|||
return options, subcommand, suboptions, subargs
|
||||
|
||||
|
||||
# callback for an option with variable arguments
|
||||
# parser.add_option("-c", "--callback", dest="vararg_attr",
|
||||
# action="callback", callback=vararg_callback)
|
||||
|
||||
def vararg_callback(option, opt_str, value, parser):
|
||||
"""Callback for an option with variable arguments.
|
||||
Manually collect arguments right of a callback-action
|
||||
option (ie. with action="callback"), and add the resulting
|
||||
list to the destination var.
|
||||
|
||||
Usage:
|
||||
parser.add_option("-c", "--callback", dest="vararg_attr",
|
||||
action="callback", callback=vararg_callback)
|
||||
|
||||
Details:
|
||||
http://docs.python.org/2/library/optparse.html#callback-example-6-variable-arguments
|
||||
"""
|
||||
assert value is None
|
||||
value = []
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue