Issue 362:Make the default template string for the list command configurable.

This commit is contained in:
kraymer 2012-05-17 00:48:55 +02:00
parent f93dd6999b
commit 81fc626ba7
2 changed files with 11 additions and 1 deletions

View file

@ -803,6 +803,8 @@ default_commands.append(import_cmd)
# list: Query and show library contents.
DEFAULT_LIST_FORMAT = '$artist - $album - $title'
def list_items(lib, query, album, path, fmt):
"""Print out items in lib matching query. If album, then search for
albums instead of single items. If path, print the matched objects'
@ -838,7 +840,10 @@ list_cmd.parser.add_option('-p', '--path', action='store_true',
list_cmd.parser.add_option('-f', '--format', action='store',
help='print with custom format', default=None)
def list_func(lib, config, opts, args):
list_items(lib, decargs(args), opts.album, opts.path, opts.format)
format = opts.format if opts.format is not None else \
ui.config_val(config, 'beets', 'list_format',
DEFAULT_LIST_FORMAT)
list_items(lib, decargs(args), opts.album, opts.path, format)
list_cmd.func = list_func
default_commands.append(list_cmd)

View file

@ -171,6 +171,11 @@ section header:
This option is historical and deprecated: it's almost always more
appropriate to use ``import_move`` instead.
``list_format``
Format to use when listing library content using ``beet list``. Defaults to
``$artist - $album - $title``. The ``-f`` command-line option override this
setting.
.. _path-format-config:
Path Format Configuration