diff --git a/modeset2.py b/modeset2.py index 3f97f45..63a1f53 100755 --- a/modeset2.py +++ b/modeset2.py @@ -3,6 +3,7 @@ # Ferit Yiğit BALABAN , 2022 # from datetime import datetime as dt +import sys START_NIGHT = "22.30" @@ -10,8 +11,8 @@ START_DAY = "8.20" def get_hour(): - if dt.now().minute == 0: - return f"{dt.now().hour}.00" + if 0 <= dt.now().minute and dt.now().minute <= 9: + return f"{dt.now().hour}.0{dt.now().minute}" return f"{dt.now().hour}.{dt.now().minute}" @@ -30,9 +31,30 @@ def get_mode(): def main(): - print("modeset2 by fyb") - print(f"local machine time: {get_hour()}") - print(f"current mode is: {get_mode()}") + sys.argv.remove(sys.argv[0]) + sys.argv.reverse() + if len(sys.argv) == 1: + if sys.argv[0] == "--login": + print("Login") + elif sys.argv[0] == "--lock": + print("Lock") + elif sys.argv[0] == "--unlock": + print("Unlock") + elif sys.argv[0] == "--shutdown": + print("Shutdown") + elif len(sys.argv) == 0: + print("modeset2 by fyb") + print(f"local machine time: {get_hour()}") + print(f"current mode is: {get_mode()}") + print("""Available options: +1. Login +2. Lock +3. Unlock +4. Shutdown""") + else: + print("Issuing more than 1 argument to modeset2 is not supported yet. Aborting...") + exit(1) + exit(0) if __name__ == '__main__':