From 916ceb4b15201675f6dcd16289e1c7faa5415b66 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Fri, 17 May 2013 11:55:17 -0700 Subject: [PATCH] changelog and tweaks for #275 I've removed the -p option. The command now always shows plugin-provided template fields if any are available. We also avoid printing out blank lines for plugins that don't provide fields. --- beets/ui/commands.py | 20 ++++++++++---------- docs/changelog.rst | 2 ++ docs/reference/cli.rst | 9 ++++----- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/beets/ui/commands.py b/beets/ui/commands.py index 75fdd5d23..c6096750e 100644 --- a/beets/ui/commands.py +++ b/beets/ui/commands.py @@ -91,20 +91,20 @@ def _showdiff(field, oldval, newval): fields_cmd = ui.Subcommand('fields', help='show fields available for queries and format strings') -fields_cmd.parser.add_option('-p', '--plugins', dest='plugins', - action='store_true', - help='show available plugin fields as well') def fields_func(lib, opts, args): - print("Available item fields:") + print("Item fields:") print(" " + "\n ".join([key for key in library.ITEM_KEYS])) - print("\nAvailable album fields:") + + print("\nAlbum fields:") print(" " + "\n ".join([key for key in library.ALBUM_KEYS])) - if opts.plugins: - print("\nAvailable plugin fields:") - for plugin in plugins.find_plugins(): - fields = plugin.template_fields.iteritems() - print(" " + "\n ".join([key for (key, value) in fields])) + + plugin_fields = [] + for plugin in plugins.find_plugins(): + plugin_fields += plugin.template_fields.keys() + if plugin_fields: + print("\nTemplate fields from plugins:") + print(" " + "\n ".join(plugin_fields)) fields_cmd.func = fields_func default_commands.append(fields_cmd) diff --git a/docs/changelog.rst b/docs/changelog.rst index c44ecd867..fb3e97a4d 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -23,6 +23,8 @@ Changelog to some fixes in dealing with special characters. * Plugin-provided template fields now work for both Albums and Items. Thanks to Pedro Silva. +* The :ref:`fields-cmd` command shows template fields provided by plugins. + Thanks again to Pedro Silva. 1.1.0 (April 29, 203) --------------------- diff --git a/docs/reference/cli.rst b/docs/reference/cli.rst index a5e0438ab..cedc4a233 100644 --- a/docs/reference/cli.rst +++ b/docs/reference/cli.rst @@ -246,17 +246,16 @@ Show some statistics on your entire library (if you don't provide a The ``-e`` (``--exact``) option makes the calculation of total file size more accurate but slower. +.. _fields-cmd: + fields `````` :: - beet fields [-p] + beet fields Show the item and album metadata fields available for use in :doc:`query` and -:doc:`pathformat`. - -The ``-p`` (``--plugins``) option shows available plugin fields in -addition to the standard ones. +:doc:`pathformat`. Includes any template fields provided by plugins. Global Flags ------------