diff --git a/pomodoroprompt.py b/pomodoroprompt.py index ad307be..c0fb640 100644 --- a/pomodoroprompt.py +++ b/pomodoroprompt.py @@ -24,6 +24,22 @@ def pomodoro_prompt_report(whatnext): whatdid = '' return whatdid +def quit_prompt(): + print('\nPress p to start a new pomodoro, q to quit') + choice = input('p/q: ').strip() + if choice.lower() in ('p', 'pomodoro'): + return + elif choice.lower() in ('q', 'quit', 'exit'): + quit() + else: + quit_prompt() + +def log_step(text): + # timelog.touch(exist_ok=True) + # with timelog.open('r+') as f: + # pp = PomodoroPrompt(timelog=f) + return + def record_task(whatdid, start, end=None): if end is None: end = datetime.now(pytz.utc) @@ -55,15 +71,13 @@ def main(): if choice.lower() in ('y', 'yes', ''): whatdid = pomodoro_prompt_report(whatnext) record_task(whatdid, start) + else: + quit_prompt() else: print('What did you break?') # If we somehow end up here, try a last-ditch effort to save. record_task('Incomplete, interrupted task:' + whatnext, start) - # timelog.touch(exist_ok=True) - # with timelog.open('r+') as f: - # pp = PomodoroPrompt(timelog=f) - if __name__ == '__main__': main()