From 0a411d21a4fe70a6db8496114a6dd49dd4cf345a Mon Sep 17 00:00:00 2001 From: Waishnav Date: Fri, 11 Mar 2022 23:40:58 +0530 Subject: updating executable file and added function in time_operation module --- src/bin/watcher | 53 +++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 39 insertions(+), 14 deletions(-) (limited to 'src/bin') diff --git a/src/bin/watcher b/src/bin/watcher index 9be5779..126341a 100755 --- a/src/bin/watcher +++ b/src/bin/watcher @@ -1,27 +1,52 @@ #!/usr/bin/python ## watcher --start == will starts the process of making csv -# watcher --daily == will give you your day overview till that point -# watcher --week == will gives user their week overview of screen time +# watcher --daily-summary == will give you your day overview till that point +# watcher --week-summary == will gives user their week overview of screen time import os import sys sys.path.insert(0, "/usr/share/Watcher/") +import argparse +import watch_log as x +from colored_text import Color +import report_creation as rc -import log_files as x -#import report_creation +def help_option(): + print(Color.BLUE("Watcher") + " - Minimal open source screen-time tracker\n") + print(Color.YELLOW("USAGE:")+"\n\t watcher [OPTION]\n") + print(Color.YELLOW("OPTIONS")) + print("\t-ds, --daily-summary Displays where you have spend your time of that day") + print("\t-ws, --week-summary Displays screen-time of each day of week") + print("\nFor more information see github repo: https://github.com/Waishnav/Watcher") -# + +#print("▒▒▒\t▒▒▒\n███") arg = sys.argv[1] -if arg == "-ds": - a = os.popen('''python3 /usr/share/Watcher/report_creation.py''').read() - print(a) +if arg == "-ds" or arg == "--daily-summary": + rc.daily_summary() +elif arg == "-ws" or arg == "--week-summary": + rc.week_summary() +elif arg == "-h" or arg == "--help": + help_option() +elif arg == "--start": + x.log_creation() +elif arg == "--version": + print("Version: 1.0") +else: + print(Color.RED("Wrong")+" [OPTION] choosen. Have a look at the Options!!\n") + print(Color.YELLOW("OPTIONS")) + print("\t-ds, --daily-summary Displays where you have spend your time of that day") + print("\t-ws, --week-summary Displays screen-time of each day of week") -#elif arg == "daily": -# print("daily summary") -#def main() -> None: - ... +#parser = argparse.ArgumentParser(description="Minimal open source screen-time calulator for digitally wellbeing") +#parser.add_argument() +#args = parser.parse_args() +#print(args) -#if __name__ == "__main__": -# main() +#def main(args=None): +# if arg is None: +# print("") +# else: +# print('''▒▒▒ ███ ▒▒▒ ▒▒▒ ▒▒▒ ▒▒▒ ▒▒▒\n▒▒▒ ███ ▒▒▒ ███ ▒▒▒ ███ ███\n███ ███ ███ ███ ▒▒▒ ███ ███\n███ ███ ███ ███ ███ ███ ███\n███ ███ ███ ███ ███ ███ ███\n███ ███ ███ ███ ███ ███ ███\n███ ███ ███ ███ ███ ███ ███''') -- cgit v1.2.3