Created
February 23, 2018 13:23
-
-
Save pixyj/8c5e810ea6d752802269218b26fbf6e7 to your computer and use it in GitHub Desktop.
Simple command line timer for macOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import os | |
import time | |
if __name__ == "__main__": | |
parser = argparse.ArgumentParser(description='Timer') | |
parser.add_argument('-s','--seconds', help='Seconds from now', required=True) | |
args = vars(parser.parse_args()) | |
seconds = int(args['seconds']) | |
for i in range(seconds): | |
time.sleep(1) | |
if i % 15 == 0: | |
print(seconds - i) | |
seconds_word = 'seconds' if seconds != 1 else 'second' | |
os.system("say {} {} up ".format(seconds, seconds_word)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment