remove OD if name == description is now managed with internal argparser mechanism

This commit is contained in:
2019-07-28 22:44:17 +02:00
parent 9bc52bcbbb
commit 79ddb8bc11
2 changed files with 14 additions and 19 deletions

View File

@ -9,7 +9,7 @@ from tiramisu import IntOption, StrOption, BoolOption, ChoiceOption, \
from tiramisu_api import Config as JsonConfig
def get_config(json, has_tree=False, default_verbosity=False, add_long=False, add_store_false=False):
def get_config(json, has_tree=False, default_verbosity=False, add_long=False, add_store_false=False, empty_optiondescription=False):
choiceoption = ChoiceOption('cmd',
'choice the sub argument',
('str', 'list', 'int', 'none'),
@ -26,8 +26,12 @@ def get_config(json, has_tree=False, default_verbosity=False, add_long=False, ad
booloption,
short_booloption,
])
if empty_optiondescription:
descr = None
else:
descr = 'First OptionDescription'
od1 = OptionDescription('od1',
'First OptionDescription',
descr,
[od0])
before = StrOption('before',
'Before',
@ -137,9 +141,6 @@ def test_optiondescription_help_remove_empty_description_od(json):
optional arguments:
-h, --help show this help message and exit
od1:
First OptionDescription
od1.od0:
Sub-Tree 1
@ -148,13 +149,17 @@ od1.od0:
increase output verbosity
-nv, --od1.od0.no-verbosity
od2:
--od2.before BEFORE Before
--od2.after AFTER After
od2.subtree:
Sub-Tree 2
--od2.subtree.str STR
string option 2
"""
parser = TiramisuCmdlineParser(get_config(json), 'prog.py', remove_empty_description_od=True)
parser = TiramisuCmdlineParser(get_config(json, empty_optiondescription=True), 'prog.py')
f = StringIO()
with redirect_stdout(f):
parser.print_help()