Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow home access "/" from anywhere #2437

Merged
merged 2 commits into from
Aug 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion openbb_terminal/helper_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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".*?"
Expand Down Expand Up @@ -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


Expand Down
5 changes: 4 additions & 1 deletion openbb_terminal/parent_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "/")
Expand Down Expand Up @@ -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)

Expand Down