add display_modified_value parameter

This commit is contained in:
2019-07-30 06:58:16 +02:00
parent 7fe8cf322d
commit e2c4e3381a
3 changed files with 234 additions and 1 deletions

View File

@ -223,6 +223,7 @@ class TiramisuCmdlineParser(ArgumentParser):
root: str=None,
fullpath: bool=True,
remove_empty_od: bool=False,
display_modified_value: bool=True,
formatter_class=HelpFormatter,
_forhelp: bool=False,
**kwargs):
@ -230,6 +231,7 @@ class TiramisuCmdlineParser(ArgumentParser):
self.config = config
self.root = root
self.remove_empty_od = remove_empty_od
self.display_modified_value = display_modified_value
if TiramisuHelpFormatter not in formatter_class.__mro__:
formatter_class = type('TiramisuHelpFormatter', (TiramisuHelpFormatter, formatter_class), {})
formatter_class.remove_empty_od = self.remove_empty_od
@ -287,6 +289,7 @@ class TiramisuCmdlineParser(ArgumentParser):
self.prog,
root=self.root,
remove_empty_od=self.remove_empty_od,
display_modified_value=self.display_modified_value,
formatter_class=self.formatter_class,
epilog=self.epilog,
description=self.description,
@ -407,6 +410,8 @@ class TiramisuCmdlineParser(ArgumentParser):
'type': option.type(),
'name': name,
'value': value}
if not self.display_modified_value:
continue
if 'positional' in properties:
if option.type() == 'boolean':
raise ValueError(_('boolean option must not be positional'))
@ -548,6 +553,7 @@ class TiramisuCmdlineParser(ArgumentParser):
root=self.root,
fullpath=self.fullpath,
remove_empty_od=self.remove_empty_od,
display_modified_value=self.display_modified_value,
formatter_class=self.formatter_class,
epilog=self.epilog,
description=self.description,
@ -560,6 +566,7 @@ class TiramisuCmdlineParser(ArgumentParser):
root=self.root,
fullpath=self.fullpath,
remove_empty_od=self.remove_empty_od,
display_modified_value=self.display_modified_value,
formatter_class=self.formatter_class,
epilog=self.epilog,
description=self.description,