logout working

This commit is contained in:
Diogo Sousa
2023-01-25 10:50:36 +00:00
parent f8566efae8
commit e86163d2d8
2 changed files with 14 additions and 14 deletions

View File

@@ -274,13 +274,14 @@ class BaseController(metaclass=ABCMeta):
def log_queue(self) -> None:
"""Log command queue."""
joined_queue = self.COMMAND_SEPARATOR.join(self.queue)
if self.queue and not self.contains_keys(joined_queue):
logger.info(
"QUEUE: {'path': '%s', 'queue': '%s'}",
self.PATH,
joined_queue,
)
if self.queue:
joined_queue = self.COMMAND_SEPARATOR.join(self.queue)
if not self.contains_keys(joined_queue):
logger.info(
"QUEUE: {'path': '%s', 'queue': '%s'}",
self.PATH,
joined_queue,
)
def log_cmd_and_queue(
self, known_cmd: str, other_args_str: str, the_input: str
@@ -673,12 +674,7 @@ class BaseController(metaclass=ABCMeta):
ns_parser = self.parse_simple_args(parser, other_args)
if ns_parser:
i = console.input("Are you sure you want to logout? (y/n) ", style="info")
console.print("")
if i.lower() == "y":
self.queue.insert(0, "y")
# TODO: this command is not working properly inside menus
logout()
logout()
@log_start_end(log=logger)
def call_whoami(self, other_args: List[str]) -> None:
@@ -942,6 +938,10 @@ class BaseController(metaclass=ABCMeta):
# Process the input command
self.queue = self.switch(an_input)
if an_input == "logout":
return ["logout"]
if not self.queue or (
self.queue and self.queue[0] not in ("quit", "help")
):

View File

@@ -916,7 +916,7 @@ def terminal(jobs_cmds: List[str] = None, test_mode=False):
print_goodbye()
break
if an_input == "logout" and "y" in t_controller.queue:
if an_input == "logout":
break
except SystemExit: