diff --git a/app/main.py b/app/main.py index 8b61fbf..3b50ad2 100644 --- a/app/main.py +++ b/app/main.py @@ -18,28 +18,32 @@ errcode = None # Initialize Lib Modules -colors = corelibs.colors.Stdout() +color = corelibs.colors.Stdout() + # Core Functions def fdate(timestamp): return timestamp.strftime("%m/%d/%Y, %H:%M:%S") + # Functions def start(): if version is None or version == "": - print(f"==> {colors.yellow}WARNING - No version was found in app configuration{colors.end}") - print(f"PyTerm - Beta Release [no version] {colors.yellow}(Unstable){colors.end}") - else: print(f"PyTerm - Beta Release v{version} {colors.yellow}(Unstable){colors.end}") + print(f"==> {color.yellow}WARNING - No version was found in app configuration{color.end}") + print(f"PyTerm - Beta Release [no version] {color.yellow}(Unstable){color.end}") + else: print(f"PyTerm - Beta Release v{version} {color.yellow}(Unstable){color.end}") print(f"Running as PID: {pid}") + def listen_for_command(errorcode): - if errorcode is None or errorcode == 0: cmd = input(f"{colors.cyan}{user}{colors.end}@{colors.blue}{host}{colors.end} <{wdir}> % ") - else: cmd = input(f"{colors.red}{errorcode}{colors.end} {colors.cyan}{user}{colors.end}@{colors.blue}{host}{colors.end} <{wdir}> % ") + if errorcode is None or errorcode == 0: cmd = input(f"{color.cyan}{user}{color.end}@{color.blue}{host}{color.end} <{wdir}> % ") + else: cmd = input(f"{color.red}{errorcode}{color.end} {color.cyan}{user}{color.end}@{color.blue}{host}{color.end} <{wdir}> % ") rescode = None if cmd.lower() == "exit": exit(0) else: rescode = os.system(cmd) return rescode + def cleanup(): """Cleans up the environment of all variables""" del errcode @@ -47,7 +51,7 @@ def cleanup(): del pid del host del user - del colors + del color # Initialization