Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --outfile-keep flag to keep outfile on termdown exit instead of deleting. #97

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions termdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ def countdown(
voice_prefix=None,
exec_cmd=None,
outfile=None,
outfile_keep=False,
no_bell=False,
no_seconds=False,
no_text_magic=True,
Expand Down Expand Up @@ -531,7 +532,7 @@ def countdown(
with curses_lock:
if not no_window_title:
os.write(stdout.fileno(), "\033]2;\007".encode())
if outfile:
if outfile and not outfile_keep:
os.remove(outfile)
quit_event.set()
input_thread.join()
Expand All @@ -550,6 +551,7 @@ def stopwatch(
quit_after=None,
title=None,
outfile=None,
outfile_keep=False,
no_window_title=False,
time=False,
time_format=None,
Expand Down Expand Up @@ -683,7 +685,7 @@ def stopwatch(
with curses_lock:
if not no_window_title:
os.write(stdout.fileno(), "\033]2;\007".encode())
if outfile:
if outfile and not outfile_keep:
os.remove(outfile)
quit_event.set()
input_thread.join()
Expand Down Expand Up @@ -750,6 +752,8 @@ def input_thread_body(stdscr, input_queue, quit_event, curses_lock):
"choose VOICE from `say -v '?'` or `espeak --voices`)")
@click.option("-o", "--outfile", metavar="PATH", callback=verify_outfile,
help="File to write current remaining/elapsed time to")
@click.option("--outfile-keep", default=False, is_flag=True,
help="Keep outfile on termdown exit instead of deleting.")
@click.option("--exec-cmd", metavar="CMD",
help="Runs CMD every second. '{0}' and '{1}' in CMD will be replaced with the "
"remaining/elapsed number of seconds and a more sparse annunciation as in "
Expand Down