remove_empty_description_od with path
This commit is contained in:
parent
1ade6c883f
commit
b0849ab260
2 changed files with 10 additions and 4 deletions
|
@ -42,7 +42,7 @@ def get_config(json, has_tree=False, default_verbosity=False, add_long=False, ad
|
||||||
'Sub-Tree 2',
|
'Sub-Tree 2',
|
||||||
[str_])
|
[str_])
|
||||||
od2 = OptionDescription('od2',
|
od2 = OptionDescription('od2',
|
||||||
'',
|
None,
|
||||||
[before, subtree, after])
|
[before, subtree, after])
|
||||||
root = OptionDescription('root',
|
root = OptionDescription('root',
|
||||||
'root',
|
'root',
|
||||||
|
|
|
@ -124,8 +124,14 @@ class TiramisuHelpFormatter(HelpFormatter):
|
||||||
# Remove OD if name == description
|
# Remove OD if name == description
|
||||||
if self.items and \
|
if self.items and \
|
||||||
self.formatter.remove_empty_description_od and \
|
self.formatter.remove_empty_description_od and \
|
||||||
self.items[0][0].__name__ == '_format_text' and \
|
self.items[0][0].__name__ == '_format_text':
|
||||||
self.items[0][1][0] == self.heading:
|
name = self.items[0][1][0]
|
||||||
|
path = self.heading
|
||||||
|
if '.' in path:
|
||||||
|
compare = path.rsplit('.', 1)[1]
|
||||||
|
else:
|
||||||
|
compare = path
|
||||||
|
if name == path:
|
||||||
return ''
|
return ''
|
||||||
return super().format_help()
|
return super().format_help()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue