boolean --config are now case insensitive, refs #284

This commit is contained in:
Simon Willison 2018-05-24 22:53:58 -07:00
commit b9b9358346
No known key found for this signature in database
GPG key ID: 17E2DEA2588B7F52

View file

@ -41,12 +41,12 @@ class Config(click.ParamType):
# Type checking
default = DEFAULT_CONFIG[name]
if isinstance(default, bool):
if value not in ('on', 'off', 'true', 'false', '1', '0'):
if value.lower() not in ('on', 'off', 'true', 'false', '1', '0'):
self.fail(
'"{}" should be on/off/true/false'.format(name), param, ctx
)
return
return name, value in ('on', 'true', '1')
return name, value.lower() in ('on', 'true', '1')
elif isinstance(default, int):
if not value.isdigit():
self.fail(