Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set field values on the import command line #1881 #2581

Merged
merged 10 commits into from
Jun 13, 2017
Prev Previous commit
Next Next commit
implemented error handling for invalid, non-key/value cli argumnets
bartkl committed May 31, 2017
commit b5a8891872d7e4b386a1cf9d381cde5706482503
10 changes: 9 additions & 1 deletion beets/ui/__init__.py
Original file line number Diff line number Diff line change
@@ -1075,7 +1075,15 @@ def _store_dict(option, opt_str, value, parser):
setattr(parser.values, dest, dict())
option_values = getattr(parser.values, dest)

key, value = map(lambda s: util.text_string(s), value.split('='))
try:
key, value = map(lambda s: util.text_string(s), value.split('='))
if not (key and value):
raise ValueError
except ValueError:
raise UserError(
"supplied argument `{0}' is not of the form `key=value'"
.format(value))

option_values[key] = value