Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,36 +18,40 @@
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
del wdir
del pid
del host
del user
del colors
del color


# Initialization
Expand Down