Commit 7130a53e authored by Emmanuel Garette's avatar Emmanuel Garette

hangman now works

parent 1fed1eef
......@@ -8,9 +8,7 @@ import unicodedata
import re
from os import unlink
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 import RegexpOption, OptionDescription, Config, IntOption, UnicodeOption, BoolOption, ParamOption, Params, default_storage
from tiramisu_cmdline_parser import TiramisuCmdlineParser
......@@ -147,15 +145,16 @@ def main():
#descr = OptionDescription('proposals',
# 'Suggesting letters',
# options)
storage_type.set('sqlite3')
default_storage.setting(engine='sqlite3')
config = Config(OptionDescription('root', 'root', [word, proposal_word, misses, proposals_left] + options), persistent=True, session_id='hangman')
parser = TiramisuCmdlineParser(config)
config.property.read_write()
try:
parser = TiramisuCmdlineParser(config)
parser.parse_args()
except ValueError:
# if no more suggestion
pass
config = parser.get_config()
filename = '{}/tiramisu.db'.format(SETTING.dir_database)
filename = '/tmp/tiramisu.db'
lost = False
for name in ['proposal_word', 'misses', 'proposals_left']:
option = config.option(name)
......
......@@ -207,8 +207,8 @@ class TiramisuCmdlineParser(ArgumentParser):
if 'positional' in properties:
if option.type() == 'boolean':
raise ValueError('boolean option must not be positional')
if not 'mandatory' in properties:
raise ValueError('"positional" argument must be "mandatory" too')
# if not 'mandatory' in properties:
# raise ValueError('"positional" argument must be "mandatory" too')
args = [option.path()]
if _forhelp:
kwargs['default'] = obj.value.default()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment