From e947cf36fb13f0a8fc784fed44efe88c7ca77196 Mon Sep 17 00:00:00 2001 From: DidierRLopes Date: Sat, 27 Aug 2022 17:36:25 +0100 Subject: [PATCH] Allow root access --- openbb_terminal/helper_funcs.py | 8 +++++++- openbb_terminal/parent_classes.py | 5 ++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/openbb_terminal/helper_funcs.py b/openbb_terminal/helper_funcs.py index 7b55b7360061..2a787fe2372d 100644 --- a/openbb_terminal/helper_funcs.py +++ b/openbb_terminal/helper_funcs.py @@ -134,6 +134,13 @@ def parse_and_split_input(an_input: str, custom_filters: List) -> List[str]: List[str] Command queue as list """ + # Make sure that the user can go back to the root when doing "/" + if an_input: + if an_input == "/": + an_input = "home" + elif an_input[0] == "/": + an_input = "home" + an_input + # everything from ` -f ` to the next known extension file_flag = r"(\ -f |\ --file )" up_to = r".*?" @@ -175,7 +182,6 @@ def parse_and_split_input(an_input: str, custom_filters: List) -> List[str]: if len(matching_placeholders) > 0: for tag in matching_placeholders: commands[command_num] = command.replace(tag, placeholders[tag]) - return commands diff --git a/openbb_terminal/parent_classes.py b/openbb_terminal/parent_classes.py index a391d9866e48..c0daf9944fc1 100644 --- a/openbb_terminal/parent_classes.py +++ b/openbb_terminal/parent_classes.py @@ -102,7 +102,6 @@ def __init__(self, queue: List[str] = None) -> None: """ self.check_path() self.path = [x for x in self.PATH.split("/") if x != ""] - self.queue = ( self.parse_input(an_input="/".join(queue)) if (queue and self.PATH != "/") @@ -648,6 +647,10 @@ def menu(self, custom_path_menu_above: str = ""): an_input = "exit" try: + # Allow user to go back to root + if an_input == "/": + an_input = "home" + # Process the input command self.queue = self.switch(an_input)