From 0518f3357196b1a75e568e0055c2e5f0ee0613e1 Mon Sep 17 00:00:00 2001 From: Richard Mwewa <74001397+rly0nheart@users.noreply.github.com> Date: Fri, 23 Dec 2022 16:52:46 +0200 Subject: [PATCH] Update main.py --- octosuite/main.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/octosuite/main.py b/octosuite/main.py index d39b38b..addd667 100644 --- a/octosuite/main.py +++ b/octosuite/main.py @@ -68,17 +68,21 @@ def octosuite(): while True: xprint(f"{white}┌──({red}{getpass.getuser()}{white}@{red}octosuite{white})\n├──[~{green}{os.getcwd()}{white}]\n└╼ {reset}",end="") command_input = input().lower() - print("\n") """ Iterate over the command_map and check if the user input matches any command in it [command_map], if there's a match, we return its method. If no match is found, we ignore it. """ - for command, method in run.command_map: - if command_input == command: - method() - print("\n") - else: - pass + if command_input[:2] == 'cd': + os.chdir(command_input[3:]) + elif command_input[:2] == 'ls': + os.system(f'dir {command_input[3:]}' if os.name == 'nt' else f'ls {command_input[3:]}') + else: + for command, method in run.command_map: + if command_input == command: + method() + print("\n") + else: + pass except KeyboardInterrupt: logging.warning(ctrl_c)