print_help when jump back to previous menu (#1168)

* print_help when jump back to previous menu

* help when quitting

* default flag to False

Co-authored-by: theorish <tep@foundian.com>
Co-authored-by: DidierRLopes <dro.lopes@campus.fct.unl.pt>
This commit is contained in:
devwolff
2022-01-11 04:34:27 +10:00
committed by GitHub
parent 6b2a500149
commit 80a4796405
3 changed files with 9 additions and 0 deletions

View File

@@ -42,3 +42,6 @@ ENABLE_QUICK_EXIT = strtobool(os.getenv("GTFF_ENABLE_QUICK_EXIT", "False"))
# Open report as HTML, otherwise notebook
OPEN_REPORT_AS_HTML = strtobool(os.getenv("GTFF_OPEN_REPORT_AS_HTML", "True"))
# Enable auto print_help when exiting menus
ENABLE_EXIT_AUTO_HELP = strtobool(os.getenv("GTFF_ENABLE_EXIT_AUTO_HELP", "False"))

View File

@@ -185,6 +185,9 @@ class BaseController(metaclass=ABCMeta):
if len(self.queue) > 1:
return self.queue[1:]
if gtff.ENABLE_EXIT_AUTO_HELP:
return ["help"]
return []
# Consume 1 element from the queue

View File

@@ -230,6 +230,9 @@ def terminal(jobs_cmds: List[str] = None):
print_goodbye()
break
if gtff.ENABLE_EXIT_AUTO_HELP and len(t_controller.queue) > 1:
t_controller.queue = t_controller.queue[1:]
# Consume 1 element from the queue
an_input = t_controller.queue[0]
t_controller.queue = t_controller.queue[1:]