From 386578d69c1b92646397de2af3fed5d44b0c2811 Mon Sep 17 00:00:00 2001 From: jmwatte Date: Fri, 13 Nov 2015 11:24:19 +0100 Subject: [PATCH] change opts.extra to type choice --- beetsplug/edit.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/beetsplug/edit.py b/beetsplug/edit.py index 62dcd8bdc..406cffc65 100644 --- a/beetsplug/edit.py +++ b/beetsplug/edit.py @@ -101,7 +101,10 @@ class EditPlugin(plugins.BeetsPlugin): help='interactively edit metadata') edit_command.parser.add_option( '-e', '--extra', - action='store', + action='append', + type='choice', + choices=library.Item.all_keys() + + library.Album.all_keys(), help='add additional fields to edit', ) edit_command.parser.add_option( @@ -188,8 +191,7 @@ class EditPlugin(plugins.BeetsPlugin): self.fields = self.albumfields if opts.album else self.itemfields # if opts.extra is given add those if opts.extra: - fi = (opts.extra).replace('$', "").split() - self.fields.extend([f for f in fi if f not in self.fields]) + self.fields.extend([f for f in opts.extra if f not in self.fields]) # make sure we got the id for identification if 'id' not in self.fields: self.fields.insert(0, 'id')