diff --git a/water-reminder/main.py b/water-reminder/main.py index f6dc4d7..193a145 100644 --- a/water-reminder/main.py +++ b/water-reminder/main.py @@ -1,5 +1,18 @@ import time from plyer import notification # can be installed by pip install plyer +import argparse + +def create_arg_parser(): + parser = argparse.ArgumentParser(description='Simple Application to remind you to drink water after specific period of time.') + parser.add_argument("-t", "--timelimit", type=str, required=False, help="Enter Timeinterval after which you want notification") + return parser + +parser = create_arg_parser() +args = parser.parse_args() + +time_interval = 6 +if args.timelimit: + time_interval = args.timelimit if __name__ == "__main__": while True: @@ -9,7 +22,7 @@ app_icon = "icon.png", timeout = 10 # Will stay for 10 seconds. ) - time.sleep(6) # Will remind after one hour. + time.sleep(time_interval) # Will remind after one hour. # In case you want to close the program and the notification should keep coming run the program using pythonw ./main.py ( after going to the folder ).