diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/Makefile b/Makefile old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/bugpy-mos-0.py b/bugpy-mos-0.py old mode 100644 new mode 100755 index fecd0d4..f9a37c5 --- a/bugpy-mos-0.py +++ b/bugpy-mos-0.py @@ -6,12 +6,14 @@ 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 # list_files.main() -if_verbose = 0 +if_verbose = 0 def verbose(strings): if if_verbose == 1: @@ -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") diff --git a/config/pointerfile.txt b/config/pointerfile.txt old mode 100644 new mode 100755 index 9ee74b3..5b4c908 --- a/config/pointerfile.txt +++ b/config/pointerfile.txt @@ -26,3 +26,6 @@ man: help exit: exit poweroff: exit shutdown: exit + +mkdir: make_directory +make_directory: make_directory diff --git a/scripts/__init__.py b/scripts/__init__.py old mode 100644 new mode 100755 diff --git a/scripts/color_print/__init__.py b/scripts/color_print/__init__.py new file mode 100755 index 0000000..e69de29 diff --git a/scripts/color_print/color_print.py b/scripts/color_print/color_print.py new file mode 100755 index 0000000..7d7874d --- /dev/null +++ b/scripts/color_print/color_print.py @@ -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") diff --git a/scripts/exit/__init__.py b/scripts/exit/__init__.py old mode 100644 new mode 100755 diff --git a/scripts/exit/exit.py b/scripts/exit/exit.py old mode 100644 new mode 100755 index 59e9522..93f43d4 --- a/scripts/exit/exit.py +++ b/scripts/exit/exit.py @@ -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) diff --git a/scripts/help/__init__.py b/scripts/help/__init__.py old mode 100644 new mode 100755 diff --git a/scripts/help/help.py b/scripts/help/help.py old mode 100644 new mode 100755 index 5fc759d..0468cec --- a/scripts/help/help.py +++ b/scripts/help/help.py @@ -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("") diff --git a/scripts/list_files/__init__.py b/scripts/list_files/__init__.py old mode 100644 new mode 100755 diff --git a/scripts/list_files/config.txt b/scripts/list_files/config.txt old mode 100644 new mode 100755 diff --git a/scripts/list_files/list_files.py b/scripts/list_files/list_files.py old mode 100644 new mode 100755 index 5bbcd52..af97789 --- a/scripts/list_files/list_files.py +++ b/scripts/list_files/list_files.py @@ -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: diff --git a/scripts/make_directory/__init__.py b/scripts/make_directory/__init__.py new file mode 100755 index 0000000..e69de29 diff --git a/scripts/make_directory/make_directory.py b/scripts/make_directory/make_directory.py new file mode 100755 index 0000000..24e118c --- /dev/null +++ b/scripts/make_directory/make_directory.py @@ -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}") diff --git a/scripts/make_file/__init__.py b/scripts/make_file/__init__.py old mode 100644 new mode 100755 diff --git a/scripts/make_file/config.txt b/scripts/make_file/config.txt old mode 100644 new mode 100755 diff --git a/scripts/make_file/make_file.py b/scripts/make_file/make_file.py old mode 100644 new mode 100755 diff --git a/scripts/remove/__init__.py b/scripts/remove/__init__.py old mode 100644 new mode 100755 diff --git a/scripts/remove/config.txt b/scripts/remove/config.txt old mode 100644 new mode 100755 diff --git a/scripts/remove/remove.py b/scripts/remove/remove.py old mode 100644 new mode 100755 diff --git a/scripts/say_greeting/__init__.py b/scripts/say_greeting/__init__.py old mode 100644 new mode 100755 diff --git a/scripts/say_greeting/config.txt b/scripts/say_greeting/config.txt old mode 100644 new mode 100755 diff --git a/scripts/say_greeting/say_greeting.py b/scripts/say_greeting/say_greeting.py old mode 100644 new mode 100755 diff --git a/scripts/touch_file/__init__.py b/scripts/touch_file/__init__.py old mode 100644 new mode 100755 diff --git a/scripts/touch_file/config.txt b/scripts/touch_file/config.txt old mode 100644 new mode 100755 diff --git a/scripts/touch_file/touch_file.py b/scripts/touch_file/touch_file.py old mode 100644 new mode 100755