tiramisu_parser => tiramisu_cmdline_parser

This commit is contained in:
Emmanuel Garette 2018-11-30 18:47:16 +01:00
parent 444d338d02
commit f0fe0e846c
4 changed files with 8 additions and 8 deletions

View file

@ -8,10 +8,10 @@ Python3 parser for command-line options and arguments using Tiramisu engine.
```python
#!/usr/bin/env python3
from tiramisu_parser import TiramisuParser
from tiramisu_cmdline_parser import TiramisuCmdlineParser
from tiramisu import StrOption, BoolOption, SymLinkOption, OptionDescription, \
Config
parser = TiramisuParser()
parser = TiramisuCmdlineParser()
booloption = BoolOption('verbosity',
'increase output verbosity',
default=False)

View file

@ -11,7 +11,7 @@ from os.path import isfile
from tiramisu import RegexpOption, OptionDescription, Config, IntOption, UnicodeOption, BoolOption, ParamOption, Params
from tiramisu.storage import storage_type
from tiramisu.storage.sqlite3.storage import SETTING
from tiramisu_parser import TiramisuParser
from tiramisu_cmdline_parser import TiramisuCmdlineParser
LANG = 'fr_FR'
@ -149,7 +149,7 @@ def main():
# options)
storage_type.set('sqlite3')
config = Config(OptionDescription('root', 'root', [word, proposal_word, misses, proposals_left] + options), persistent=True, session_id='hangman')
parser = TiramisuParser()
parser = TiramisuCmdlineParser()
parser.add_arguments(config)
try:
parser.parse_args()

View file

@ -7,8 +7,8 @@ from os.path import join, isdir
from contextlib import redirect_stdout, redirect_stderr
from argparse import ArgumentParser
#from pouet import TiramisuParser
from tiramisu_parser import TiramisuParser
#from pouet import TiramisuCmdlineParser
from tiramisu_cmdline_parser import TiramisuCmdlineParser
DATA_DIR = 'test/data/compare'
@ -76,7 +76,7 @@ def test_files(test_list):
['bar', '--verbosity'], ['--verbosity', 'bar'],
]
for arg in args:
tiramparser = TiramisuParser('prog.py')
tiramparser = TiramisuCmdlineParser('prog.py')
tiramparser_dict, tiramparser_system_err, tiramparser_error, tiramparser_help = import_subfile_and_test(test_list + '/tiramisu.py',
tiramparser, arg)
#

View file

@ -52,7 +52,7 @@ class TiramisuNamespace(Namespace):
return super().__getattribute__(key)
class TiramisuParser(ArgumentParser):
class TiramisuCmdlineParser(ArgumentParser):
def __init__(self, *args, **kwargs):
self.config = None
super().__init__(*args, **kwargs)