From 71035c50d5b43fef36765ba7106f775dd75d54bb Mon Sep 17 00:00:00 2001 From: Erik <122167559+EriktheRDev@users.noreply.github.com> Date: Sun, 5 Feb 2023 22:21:13 +0000 Subject: [PATCH] Pending changes exported from your codespace --- docs/About/changelog.txt | 4 ++++ linux.py | 25 ++++++++++++------------- windows.py | 29 ++++++++++++++--------------- 3 files changed, 30 insertions(+), 28 deletions(-) create mode 100644 docs/About/changelog.txt diff --git a/docs/About/changelog.txt b/docs/About/changelog.txt new file mode 100644 index 0000000..56f3f1f --- /dev/null +++ b/docs/About/changelog.txt @@ -0,0 +1,4 @@ +NAME: B-Kernel 2.100.0 +BUILD: 2.100.0 +DATE: Feb 5 2022 +CHANGES: Added changelog.txt \ No newline at end of file diff --git a/linux.py b/linux.py index 128a089..e9d7087 100644 --- a/linux.py +++ b/linux.py @@ -1,3 +1,4 @@ +#Imported Variables import os import shutil import subprocess @@ -10,8 +11,7 @@ cmancode = subprocess.Popen(["python", str(locationdir) + "/bin/functions/registry/r~1.py"]) subprogram = False booted = False - -# Colors | For more help; see https://stackoverflow.com/questions/287871/how-do-i-print-colored-text-to-the-terminal +# Colors class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' @@ -22,8 +22,7 @@ class bcolors: ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m' - -# The error codes are in this dictionary for easy re-use; add new ones whenever you wish :) +# Error Codes error_codes = { "0x001": "The 'bootloader' instance is already running.", "0x002": "The item you were searching for was not found.", @@ -31,8 +30,7 @@ class bcolors: "0x004": "The directory is not accessible.", "0x005": "That command doesn't exist. Type 'help' for a list of available commands." } - -# Print error function for easy re-use; make sure to use the correct error code +# Declaring Functions def print_error(error_code, print_error=True): try: error_message = f"{bcolors.FAIL}Error code {error_code}: {error_codes[error_code]}{bcolors.ENDC}" @@ -44,10 +42,8 @@ def print_error(error_code, print_error=True): return None else: return error_message - def clear_screen(): os.system("clear") - def help_command(command=None): if (command == None or command == ""): clear_screen() @@ -97,17 +93,15 @@ def Bootloader(): if booted == False: print("B-Kernel") print("(c) B-Kernel, 2023") - print("Version 1.130.0") + print("Version 2.0.0") time.sleep(random.randint(2, 5)) clear_screen() print(f"{bcolors.WARNING}Welcome to {bcolors.BOLD}B Kernel{bcolors.ENDC}") return True else: print_error("0x001") - -#Post-Determined Variables +#Calling Bootloader booted = Bootloader() -#Default Directory: /workspaces/bkernel while booted == True: command = str(input(os.getcwd() + " ")) locationdir = os.getcwd() @@ -147,6 +141,11 @@ def Bootloader(): cman = open(echo,"r") print(cman.read()) cman.close + elif command == "history": + placement = 0 + for i in history: + placement += 1 + print(str(placement) + ". " + i) elif command =="rc": comlistdir = "" echo = input("Insert Path: ") @@ -315,4 +314,4 @@ def rem(val1,val2): time.sleep(random.randint(0, 5)) booted = False else: - print_error("0x005") + print_error("0x005") \ No newline at end of file diff --git a/windows.py b/windows.py index 0cf6c3b..4f7c694 100644 --- a/windows.py +++ b/windows.py @@ -1,10 +1,9 @@ +#Imported Variables import os import shutil import subprocess from sys import version_info - os.system('color') - # Pre-determined variables location = 0 locationdir = os.getcwd() @@ -13,8 +12,8 @@ cmancode = subprocess.Popen(["python", str(locationdir) + "/bin/functions/registry/r~1.py"]) subprogram = False booted = False - -# Colors | For more help; see https://stackoverflow.com/questions/287871/how-do-i-print-colored-text-to-the-terminal +history = [] +# Colors class bcolors: HEADER = '\033[95m' OKBLUE = '\033[94m' @@ -25,8 +24,7 @@ class bcolors: ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m' - -# The error codes are in this dictionary for easy re-use; add new ones whenever you wish :) +# Error Codes error_codes = { "0x001": "The 'bootloader' instance is already running.", "0x002": "The item you were searching for was not found.", @@ -34,8 +32,7 @@ class bcolors: "0x004": "The directory is not accessible.", "0x005": "That command doesn't exist. Type 'help' for a list of available commands." } - -# Print error function for easy re-use; make sure to use the correct error code +# Declaring Functions def print_error(error_code, print_error=True): try: error_message = f"{bcolors.FAIL}Error code {error_code}: {error_codes[error_code]}{bcolors.ENDC}" @@ -47,10 +44,8 @@ def print_error(error_code, print_error=True): return None else: return error_message - def clear_screen(): os.system("cls") - def help_command(command=None): if (command == None or command == ""): clear_screen() @@ -101,7 +96,7 @@ def Bootloader(): os.system('color e0') print("B-Kernel") print("(c) B-Kernel, 2023") - print("Version 1.130.0") + print("Version 2.0.0") time.sleep(random.randint(2, 5)) clear_screen() os.system('color 0f') @@ -109,15 +104,14 @@ def Bootloader(): return True else: print_error("0x001") - -#Post-Determined Variables +#Calling Bootloader booted = Bootloader() -#Default Directory: /workspaces/bkernel while booted == True: command = str(input(os.getcwd() + " ")) locationdir = os.getcwd() comlistdir = locationdir + " " locationstr = os.listdir(os.path.dirname(os.path.realpath(__file__))) + history.append("\"" + command + "\"") if command == "registry": #Registry subprocess.Popen(["python", str(locationdir) + "/bin/functions/registry/r~2.py"]) @@ -152,6 +146,11 @@ def Bootloader(): cman = open(echo,"r") print(cman.read()) cman.close + elif command == "history": + placement = 0 + for i in history: + placement += 1 + print(str(placement) + ". " + i) elif command =="rc": comlistdir = "" echo = input("Insert Path: ") @@ -320,4 +319,4 @@ def rem(val1,val2): time.sleep(random.randint(0, 5)) booted = False else: - print_error("0x005") + print_error("0x005") \ No newline at end of file