diff --git a/pomodoroprompt.py b/pomodoroprompt.py index 88771b4..dfd881a 100644 --- a/pomodoroprompt.py +++ b/pomodoroprompt.py @@ -1,3 +1,4 @@ +import sys import csv import time from datetime import datetime, timedelta @@ -15,6 +16,8 @@ INTERRUPTED_MIN = 1 # Minimum minutes to ask to record an interrupted Pomodoro def pomodoro_prompt_plan(whatdid = ''): + """ Ask about what task will be worked on (showing last thing worked on) + """ title = "What're you gonna do?" text = '' # Instead of repeating this, i'd prefer a clean interface with the ability to get back @@ -31,6 +34,8 @@ def pomodoro_prompt_plan(whatdid = ''): return whatnext def pomodoro_prompt_report(whatnext): + """ Ask what task was completed, showing the last task claimed to be being worked on + """ title = "What'd you do?" text = '' if whatnext: @@ -42,16 +47,20 @@ def pomodoro_prompt_report(whatnext): return whatdid def quit_prompt(): + """ Confirm exit or start a new pomodoro + """ print('\nPress p to start a new pomodoro, q to quit') - choice = input('p/q: ').strip() - if choice.lower() in ('p', 'pomodoro'): + choice = input('p/q: ').strip().lower() + if choice in ('p', 'pomodoro'): return - elif choice.lower() in ('q', 'quit', 'exit'): - quit() + elif choice in ('q', 'quit', 'exit'): + sys.exit(0) else: quit_prompt() def log_step(text, utc_start, end_section=False): + """ Write detailed log of all events + """ eastern = timezone('US/Eastern') start = utc_start.astimezone(eastern) timelog_path = 'log/' + str(start.year) + '-' + format(start.month, '02') + '-' + format(start.day, '02') + '.log' @@ -64,6 +73,8 @@ def log_step(text, utc_start, end_section=False): def record_task(whatdid, start, end=None): + """ Record completed pomodoro to CSV + """ if end is None: end = datetime.now(pytz.utc) with open('timelog.csv', 'a', newline='') as csvfile: