diff --git a/TODO b/TODO index 0c89d97..92173df 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,3 @@ -v1.1 -Arrow keys in input -multiple commands at once separated by semicolon - v1.2 cloud storage diff --git a/cl_timer/interpreter.py b/cl_timer/interpreter.py index bb8168d..bdbdcca 100644 --- a/cl_timer/interpreter.py +++ b/cl_timer/interpreter.py @@ -20,6 +20,9 @@ ExitException, MutableString ) +import logging as l + +logging = l.getLogger(__name__) HOME = str(Path.home()) @@ -99,6 +102,12 @@ def interpret(command): """ Performs tasks according to what the command tells it """ + + if ';' in command: + for subcommand in command.split(';'): + interpret(subcommand.strip()) + return + if command.count('"') % 2 != 0: show_error_message('syntax error: odd number of quotes (")') @@ -135,6 +144,8 @@ def interpret(command): if command[-1] != '"': words.append(command.split(' ')[-1]) + logging.info(words) + if words[0] == 'alias': if len(words) != 3: show_error_message(f'`alias` takes exactly 2 arguments - {len(words) - 1} were given') @@ -316,7 +327,7 @@ def interpret(command): show_error_message(f'invalid time: {words[1]}') elif words[0] in aliases.keys(): - interpret(aliases[words[0]] + f' {"".join(words[1:])}') + interpret(aliases[words[0]] + f' {" ".join(words[1:])}') else: # command was not recognized show_error_message(f'{words[0]}: Invalid command') diff --git a/cl_timer/timer.py b/cl_timer/timer.py index 45d1820..7b748c3 100644 --- a/cl_timer/timer.py +++ b/cl_timer/timer.py @@ -31,6 +31,10 @@ ExitException, MutableString ) +import logging + +logging.basicConfig(filename='cl-timer.log', level=logging.INFO) + HOME = str(Path.home()) try: