Added basic fix and test

This commit is contained in:
Andrew Toolan
2018-01-20 18:23:08 +00:00
committed by Bruno Oliveira
parent 3b3d237f07
commit 2c7f94fdb9
2 changed files with 41 additions and 1 deletions

View File

@@ -1192,12 +1192,15 @@ class Config(object):
# and -o foo1=bar1 -o foo2=bar2 options
# always use the last item if multiple value set for same ini-name,
# e.g. -o foo=bar1 -o foo=bar2 will set foo to bar2
first_override_set = False
for ini_config_list in self._override_ini:
for ini_config in ini_config_list:
try:
(key, user_ini_value) = ini_config.split("=", 1)
first_override_set = True
except ValueError:
raise UsageError("-o/--override-ini expects option=value style.")
if not first_override_set:
raise UsageError("-o/--override-ini expects option=value style.")
if key == name:
value = user_ini_value
return value