Allow root access (#2437)

Co-authored-by: James Maslek <jmaslek11@gmail.com>
This commit is contained in:
DidierRLopes
2022-08-28 04:24:53 +03:00
committed by GitHub
parent 9bbca6f845
commit c30a8de32f
2 changed files with 11 additions and 2 deletions

View File

@@ -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

View File

@@ -102,7 +102,6 @@ class BaseController(metaclass=ABCMeta):
"""
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 @@ class BaseController(metaclass=ABCMeta):
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)