logilab/common
changeset 615:42c8cae57420
fix default values in help
| author | Emile Anclin <emile.anclin@logilab.fr> |
|---|---|
| date | Mon Aug 25 09:10:03 2008 +0200 (2008-08-25) |
| parents | e9b4d22793f2 |
| children | 3479a37c5e2e |
| files | configuration.py test/unittest_configuration.py |
line diff
1.1 --- a/configuration.py Wed Aug 20 19:36:38 2008 +0200 1.2 +++ b/configuration.py Mon Aug 25 09:10:03 2008 +0200 1.3 @@ -367,7 +367,7 @@ 1.4 for opt_name, opt_dict in non_group_spec_options: 1.5 args, opt_dict = self.optik_option(provider, opt_name, opt_dict) 1.6 self._optik_parser.add_option(*args, **opt_dict) 1.7 - self._all_options[opt_name] = provider 1.8 + self._all_options[opt_name] = provider 1.9 for gname, gdoc in groups: 1.10 goptions = [option for option in provider.options 1.11 if option[1].get('group') == gname] 1.12 @@ -401,10 +401,11 @@ 1.13 opt_dict['callback'] = self.cb_set_provider_option 1.14 for specific in ('default', 'group', 'inputlevel'): 1.15 if opt_dict.has_key(specific): 1.16 - del opt_dict[specific] 1.17 if (OPTPARSE_FORMAT_DEFAULT 1.18 and specific == 'default' and opt_dict.has_key('help')): 1.19 opt_dict['help'] += ' [current: %default]' 1.20 + else: 1.21 + del opt_dict[specific] 1.22 args = ['--' + opt_name] 1.23 if opt_dict.has_key('short'): 1.24 self._short_options[opt_dict['short']] = opt_name
2.1 --- a/test/unittest_configuration.py Wed Aug 20 19:36:38 2008 +0200 2.2 +++ b/test/unittest_configuration.py Mon Aug 25 09:10:03 2008 +0200 2.3 @@ -165,7 +165,7 @@ 2.4 --dothis=<y or n> 2.5 -v<string>, --value=<string> 2.6 --multiple=<comma separated values> 2.7 - you can also document the option [current: none] 2.8 + you can also document the option [current: ('yop',)] 2.9 --number=<int> 2.10 --choice=<yo|ye> 2.11 --multiple-choice=<yo|ye> 2.12 @@ -182,7 +182,7 @@ 2.13 --dothis=<y or n> 2.14 -v<string>, --value=<string> 2.15 --multiple=<comma separated values> 2.16 - you can also document the option [current: none] 2.17 + you can also document the option [current: ('yop',)] 2.18 --number=<int> 2.19 --choice=<yo|ye> 2.20 --multiple-choice=<yo|ye>
