Skip to content

Commit

Permalink
Support booleans in the cli (#45)
Browse files Browse the repository at this point in the history
Co-authored-by: Anton Benkevich <abenkevich@alertlogic.com>
anton-b and Anton Benkevich authored Dec 22, 2020
1 parent 3b822ce commit f860c63
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion alcli/cliparser.py
Original file line number Diff line number Diff line change
@@ -200,5 +200,10 @@ def parse_known_args(self, args=None, namespace=None):
elif self._spec is not None:
for name, schema in self._spec[OpenAPIKeyWord.PARAMETERS].items():
kwargs = self.make_parameter_argument(schema)
self.add_argument(f"--{name}", **kwargs)
type = schema.get(OpenAPIKeyWord.TYPE)
if type == 'boolean':
self.add_argument(f"--{name}",
action='store_true')
else:
self.add_argument(f"--{name}", **kwargs)
return super().parse_known_args(args, namespace)

0 comments on commit f860c63

Please sign in to comment.