Add the ability to quit gracefgully if no longer tracking time
This commit is contained in:
parent
501784c562
commit
57ec262f7d
1 changed files with 18 additions and 4 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue