Skip to content

Commit 3961057

Browse files
committed
Allow extra values as bool in options
* "false", "off", "no", "-" are now allowed as false value * "true", "on", "yes", "+" are now allowed as true value
1 parent c712474 commit 3961057

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/api/options.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,16 @@ def value(self, value):
9696
if value is not None and self.type is not None and not isinstance(value, self.type):
9797
try:
9898
if isinstance(value, str) and self.type == bool:
99-
value = {'false': False, 'true': True}[value.lower()]
99+
value = {
100+
'false': False,
101+
'true': True,
102+
'off': False,
103+
'on': True,
104+
'-': False,
105+
'+': True,
106+
'no': False,
107+
'yes': True
108+
}[value.lower()]
100109
else:
101110
value = self.type(value)
102111
except TypeError:

0 commit comments

Comments
 (0)