Well, this is after the 4/29 turmoil and everything seems to be working... Some of the stuff was not commited before the turmoil. However, it seems intact here... My next plan of action is full "disk" encyption with the P7C_ENC protocol and adding built-in P7C and other apps, converting them into "terminal line" tools.
This commit is contained in:
0
.gitignore
vendored
Normal file → Executable file
0
.gitignore
vendored
Normal file → Executable file
15
bugpy-mos-0.py
Normal file → Executable file
15
bugpy-mos-0.py
Normal file → Executable file
@@ -6,6 +6,8 @@ from scripts.touch_file import touch_file
|
||||
from scripts.remove import remove
|
||||
from scripts.help import help
|
||||
from scripts.exit import exit
|
||||
from scripts.make_directory import make_directory
|
||||
from scripts.color_print import color_print
|
||||
from pathlib import Path
|
||||
|
||||
# Shitty test
|
||||
@@ -27,7 +29,8 @@ def get_config_line(keyword):
|
||||
config_file = base_dir / "config" / "pointerfile.txt"
|
||||
|
||||
if not config_file.exists():
|
||||
return f"Error: {config_file} not found."
|
||||
color_print.cprint("Error", "DARKRED", sameline=True); print(": config file not found")
|
||||
return None
|
||||
|
||||
# 2. Open and search
|
||||
with config_file.open("r") as f:
|
||||
@@ -54,6 +57,8 @@ def match_command(command, args_list):
|
||||
help.main(args_list)
|
||||
elif command == "exit":
|
||||
exit.main(args_list)
|
||||
elif command == "make_directory":
|
||||
make_directory.main(args_list)
|
||||
# use if else if else if else if to match the output
|
||||
|
||||
def cmdrun(keyword):
|
||||
@@ -68,9 +73,11 @@ def cmdrun(keyword):
|
||||
return False
|
||||
|
||||
if __name__ == "__main__":
|
||||
print("BUGPy-mOS 0 \"Devvie\"")
|
||||
print("\033[2J\033[H")
|
||||
color_print.cprint("BUGPy-mOS 0 ", "GREEN", sameline=True); print("\"Devvie\"")
|
||||
while True:
|
||||
inputs = input("\nBUGS > ")
|
||||
color_print.cprint("BUGS > ", "EMPHASIS", sameline=True)
|
||||
inputs = input()
|
||||
if not inputs.strip() == "":
|
||||
if not cmdrun(inputs):
|
||||
print("BAD COMMAND")
|
||||
color_print.cprint("BAD COMMAND", "DARKRED")
|
||||
|
||||
3
config/pointerfile.txt
Normal file → Executable file
3
config/pointerfile.txt
Normal file → Executable file
@@ -26,3 +26,6 @@ man: help
|
||||
exit: exit
|
||||
poweroff: exit
|
||||
shutdown: exit
|
||||
|
||||
mkdir: make_directory
|
||||
make_directory: make_directory
|
||||
|
||||
0
scripts/__init__.py
Normal file → Executable file
0
scripts/__init__.py
Normal file → Executable file
0
scripts/color_print/__init__.py
Executable file
0
scripts/color_print/__init__.py
Executable file
38
scripts/color_print/color_print.py
Executable file
38
scripts/color_print/color_print.py
Executable file
@@ -0,0 +1,38 @@
|
||||
class Colors:
|
||||
PURPLE = '\033[95m'
|
||||
DARKBLUE = '\033[94m'
|
||||
DARKGREEN = '\033[96m'
|
||||
GREEN = '\033[92m'
|
||||
ORANGE = '\033[93m'
|
||||
DARKRED = '\033[91m'
|
||||
RESET = '\033[0m'
|
||||
EMPHASIS = '\033[1m'
|
||||
UNDERLINE = '\033[4m'
|
||||
|
||||
def cprint(text, color, sameline=None):
|
||||
color = color.upper()
|
||||
newline = "\n"
|
||||
if sameline:
|
||||
newline = ""
|
||||
if color == "PURPLE":
|
||||
print(f"{Colors.PURPLE}{text}{Colors.RESET}", end = newline)
|
||||
elif color == "DARKGREEN":
|
||||
print(f"{Colors.DARKGREEN}{text}{Colors.RESET}", end = newline)
|
||||
elif color == "DARKBLUE":
|
||||
print(f"{Colors.DARKBLUE}{text}{Colors.RESET}", end = newline)
|
||||
elif color == "GREEN":
|
||||
print(f"{Colors.GREEN}{text}{Colors.RESET}", end = newline)
|
||||
elif color == "ORANGE":
|
||||
print(f"{Colors.ORANGE}{text}{Colors.RESET}", end = newline)
|
||||
elif color == "DARKRED":
|
||||
print(f"{Colors.DARKRED}{text}{Colors.RESET}", end = newline)
|
||||
elif color == "EMPHASIS":
|
||||
print(f"{Colors.EMPHASIS}{text}{Colors.RESET}", end = newline)
|
||||
elif color == "UNDERLINE":
|
||||
print(f"{Colors.UNDERLINE}{text}{Colors.RESET}", end = newline)
|
||||
elif color == "RESET":
|
||||
print(f"{Colors.RESET}{text}", end = newline)
|
||||
|
||||
# print(f"{Colors.OKGREEN}Success:{Colors.ENDC} Build completed.")
|
||||
|
||||
# cprint("this is some text", "PURPLE")
|
||||
0
scripts/exit/__init__.py
Normal file → Executable file
0
scripts/exit/__init__.py
Normal file → Executable file
3
scripts/exit/exit.py
Normal file → Executable file
3
scripts/exit/exit.py
Normal file → Executable file
@@ -1,4 +1,5 @@
|
||||
import sys
|
||||
from ..color_print import color_print
|
||||
def main(args):
|
||||
print("Exiting BUGPy!")
|
||||
color_print.cprint("Exiting BUGPy!", "GREEN")
|
||||
sys.exit(0)
|
||||
|
||||
0
scripts/help/__init__.py
Normal file → Executable file
0
scripts/help/__init__.py
Normal file → Executable file
12
scripts/help/help.py
Normal file → Executable file
12
scripts/help/help.py
Normal file → Executable file
@@ -1,2 +1,12 @@
|
||||
from ..color_print import color_print
|
||||
def main(args):
|
||||
print("An unfinished help section! Yay")
|
||||
# Title
|
||||
color_print.cprint("HELP SECTION", "ORANGE")
|
||||
print("=" * 40)
|
||||
|
||||
# Entries
|
||||
color_print.cprint("pointerfile.txt", "GREEN", sameline=True); print(": command aliases")
|
||||
|
||||
|
||||
# Newline
|
||||
print("")
|
||||
|
||||
0
scripts/list_files/__init__.py
Normal file → Executable file
0
scripts/list_files/__init__.py
Normal file → Executable file
0
scripts/list_files/config.txt
Normal file → Executable file
0
scripts/list_files/config.txt
Normal file → Executable file
4
scripts/list_files/list_files.py
Normal file → Executable file
4
scripts/list_files/list_files.py
Normal file → Executable file
@@ -1,4 +1,5 @@
|
||||
from pathlib import Path
|
||||
from ..color_print import color_print
|
||||
|
||||
def main(args):
|
||||
# Set the directory path
|
||||
@@ -10,9 +11,10 @@ def main(args):
|
||||
if args == []:
|
||||
for entry in dir_path.iterdir():
|
||||
if entry.is_dir():
|
||||
print(f"[FOLDER] {entry.name}")
|
||||
color_print.cprint(f"[FOLDER] {entry.name}", "DARKBLUE")
|
||||
elif entry.is_file():
|
||||
print(f"[FILE] {entry.name}")
|
||||
print()
|
||||
elif args == ["--help"] or args == ["-h"]:
|
||||
print("list_files: Bro is lazy on doing this help section")
|
||||
else:
|
||||
|
||||
0
scripts/make_directory/__init__.py
Executable file
0
scripts/make_directory/__init__.py
Executable file
17
scripts/make_directory/make_directory.py
Executable file
17
scripts/make_directory/make_directory.py
Executable file
@@ -0,0 +1,17 @@
|
||||
from pathlib import Path
|
||||
import os
|
||||
|
||||
def main(args):
|
||||
if not args:
|
||||
print("make_directory: no arguments were given")
|
||||
return
|
||||
|
||||
for item in args:
|
||||
# Get the ABSOLUTE path to be 100% sure where it's going
|
||||
dir_path = Path(item).resolve()
|
||||
|
||||
try:
|
||||
dir_path.mkdir(parents=True, exist_ok=True)
|
||||
# This line is key: it tells you EXACTLY where it went
|
||||
except Exception as e:
|
||||
print(f"make_directory: error creating directory {item}: {e}")
|
||||
0
scripts/make_file/__init__.py
Normal file → Executable file
0
scripts/make_file/__init__.py
Normal file → Executable file
0
scripts/make_file/config.txt
Normal file → Executable file
0
scripts/make_file/config.txt
Normal file → Executable file
0
scripts/make_file/make_file.py
Normal file → Executable file
0
scripts/make_file/make_file.py
Normal file → Executable file
0
scripts/remove/__init__.py
Normal file → Executable file
0
scripts/remove/__init__.py
Normal file → Executable file
0
scripts/remove/config.txt
Normal file → Executable file
0
scripts/remove/config.txt
Normal file → Executable file
0
scripts/remove/remove.py
Normal file → Executable file
0
scripts/remove/remove.py
Normal file → Executable file
0
scripts/say_greeting/__init__.py
Normal file → Executable file
0
scripts/say_greeting/__init__.py
Normal file → Executable file
0
scripts/say_greeting/config.txt
Normal file → Executable file
0
scripts/say_greeting/config.txt
Normal file → Executable file
0
scripts/say_greeting/say_greeting.py
Normal file → Executable file
0
scripts/say_greeting/say_greeting.py
Normal file → Executable file
0
scripts/touch_file/__init__.py
Normal file → Executable file
0
scripts/touch_file/__init__.py
Normal file → Executable file
0
scripts/touch_file/config.txt
Normal file → Executable file
0
scripts/touch_file/config.txt
Normal file → Executable file
0
scripts/touch_file/touch_file.py
Normal file → Executable file
0
scripts/touch_file/touch_file.py
Normal file → Executable file
Reference in New Issue
Block a user