mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Make boolean options work like standard OptionParser booleans
This commit is contained in:
parent
5e0a0fa745
commit
22c2261e44
@ -325,11 +325,16 @@ class CLI(object):
|
|||||||
usage=self.get_usage(cmd),
|
usage=self.get_usage(cmd),
|
||||||
)
|
)
|
||||||
for option in cmd.options():
|
for option in cmd.options():
|
||||||
parser.add_option('--%s' % to_cli(option.cli_name),
|
o = optparse.make_option('--%s' % to_cli(option.cli_name),
|
||||||
dest=option.name,
|
dest=option.name,
|
||||||
metavar=option.type.name.upper(),
|
metavar=option.type.name.upper(),
|
||||||
help=option.doc,
|
help=option.doc,
|
||||||
)
|
)
|
||||||
|
if isinstance(option.type, ipa_types.Bool):
|
||||||
|
o.action = 'store_true'
|
||||||
|
o.default = option.default
|
||||||
|
o.type = None
|
||||||
|
parser.add_option(o)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def parse_globals(self, argv=sys.argv[1:]):
|
def parse_globals(self, argv=sys.argv[1:]):
|
||||||
|
Loading…
Reference in New Issue
Block a user