From 4c96e10f4871c379d51b8368c237f0218faecc2c Mon Sep 17 00:00:00 2001 From: snipe_blaze <72265661+notsniped@users.noreply.github.com> Date: Tue, 27 Sep 2022 15:17:40 +0530 Subject: [PATCH 1/3] Add newlines after commands --- app/main.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/main.py b/app/main.py index 8b61fbf..199a2b1 100644 --- a/app/main.py +++ b/app/main.py @@ -20,10 +20,12 @@ # Initialize Lib Modules colors = 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 == "": @@ -32,6 +34,7 @@ def start(): else: print(f"PyTerm - Beta Release v{version} {colors.yellow}(Unstable){colors.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}> % ") @@ -40,6 +43,7 @@ def listen_for_command(errorcode): else: rescode = os.system(cmd) return rescode + def cleanup(): """Cleans up the environment of all variables""" del errcode From 1c506e2319bee633969c4b919d19e9c1c7376948 Mon Sep 17 00:00:00 2001 From: snipe_blaze <72265661+notsniped@users.noreply.github.com> Date: Tue, 27 Sep 2022 15:18:42 +0530 Subject: [PATCH 2/3] Change `colors` to `color` --- app/main.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/main.py b/app/main.py index 199a2b1..05f8ffd 100644 --- a/app/main.py +++ b/app/main.py @@ -5,7 +5,7 @@ import os.path import pwd import time -import corelibs.colors +import corelibs.color # import datetime # import math @@ -18,7 +18,7 @@ errcode = None # Initialize Lib Modules -colors = corelibs.colors.Stdout() +color = corelibs.color.Stdout() # Core Functions @@ -29,15 +29,15 @@ def fdate(timestamp): # 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) @@ -51,7 +51,7 @@ def cleanup(): del pid del host del user - del colors + del color # Initialization From 9ef5b6df0d42030b17b0bbc8eff9a198784242c3 Mon Sep 17 00:00:00 2001 From: snipe_blaze <72265661+notsniped@users.noreply.github.com> Date: Tue, 27 Sep 2022 15:19:17 +0530 Subject: [PATCH 3/3] Fix undefined module error while importing `colors` module from corelibs --- app/main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/main.py b/app/main.py index 05f8ffd..3b50ad2 100644 --- a/app/main.py +++ b/app/main.py @@ -5,7 +5,7 @@ import os.path import pwd import time -import corelibs.color +import corelibs.colors # import datetime # import math @@ -18,7 +18,7 @@ errcode = None # Initialize Lib Modules -color = corelibs.color.Stdout() +color = corelibs.colors.Stdout() # Core Functions