diff options
author | Jason Gerard DeRose <jderose@redhat.com> | 2009-01-28 13:05:26 -0700 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2009-02-03 15:29:04 -0500 |
commit | 231f0bd65aec9cc0767bd6a76d5aa5b27dd37168 (patch) | |
tree | ebfa02317b5b1fe8ed1fd2c914d900da44917cef /ipalib/plugable.py | |
parent | db0168f7afdac55eb7e0488cdc05e7a77a25672d (diff) | |
download | freeipa-231f0bd65aec9cc0767bd6a76d5aa5b27dd37168.tar.gz freeipa-231f0bd65aec9cc0767bd6a76d5aa5b27dd37168.tar.xz freeipa-231f0bd65aec9cc0767bd6a76d5aa5b27dd37168.zip |
Finished reworked cli.CLI class into cli.cli plugin
Diffstat (limited to 'ipalib/plugable.py')
-rw-r--r-- | ipalib/plugable.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ipalib/plugable.py b/ipalib/plugable.py index a99cd5473..5a0076972 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -576,7 +576,7 @@ class API(DictProxy): handler.setLevel(logging.INFO) log.addHandler(handler) - def add_global_options(self, parser=None, context=None): + def build_global_parser(self, parser=None, context=None): """ Add global options to an optparse.OptionParser instance. """ @@ -597,15 +597,16 @@ class API(DictProxy): ) if context == 'cli': parser.add_option('-a', '--prompt-all', action='store_true', - help='Prompt for all values interactively' + help='Prompt for ALL values (even if optional)' ) parser.add_option('-n', '--no-prompt', action='store_false', - help="Don\'t prompt for values interactively" + dest='interactive', + help='Prompt for NO values (even if required)' ) return parser def bootstrap_with_global_options(self, parser=None, context=None): - parser = self.add_global_options(parser, context) + parser = self.build_global_parser(parser, context) (options, args) = parser.parse_args() overrides = {} if options.env is not None: @@ -619,7 +620,7 @@ class API(DictProxy): # --Jason, 2008-10-31 pass overrides[str(key.strip())] = value.strip() - for key in ('conf', 'debug', 'verbose'): + for key in ('conf', 'debug', 'verbose', 'prompt_all', 'interactive'): value = getattr(options, key, None) if value is not None: overrides[key] = value |