From a040fe72e77245f1ef9441c211c83c752131f8b1 Mon Sep 17 00:00:00 2001 From: Henrique Joaquim Date: Tue, 31 Jan 2023 13:47:36 +0000 Subject: [PATCH] Adds auto completion to `news` (#4089) * Fix plot look when using eval and add query to choices (#3881) * convert index to datetime and update choices * uncomment economy integration test * fix treasury concat bug * fix datasets concat on duplciates * Lock ruff version so that new lints dont break our CI (#3905) * Lock ruff version so that new lints dont break our CI * Bumped pre-commit ruff version * returning always a dataframe * Revert "returning always a dataframe" This reverts commit d5dbf3132f4c91115f081efb823cea214b9b6cc7. * quick fix to auto complete args --------- Co-authored-by: montezdesousa <79287829+montezdesousa@users.noreply.github.com> Co-authored-by: Colin Delahunty <72827203+colin99d@users.noreply.github.com> Co-authored-by: James Maslek --- openbb_terminal/parent_classes.py | 6 ++++++ openbb_terminal/terminal_controller.py | 1 + 2 files changed, 7 insertions(+) diff --git a/openbb_terminal/parent_classes.py b/openbb_terminal/parent_classes.py index c7e1577815ef..ce2c445c67f0 100644 --- a/openbb_terminal/parent_classes.py +++ b/openbb_terminal/parent_classes.py @@ -100,6 +100,7 @@ class BaseController(metaclass=ABCMeta): CHOICES_MENUS: List[str] = [] SUPPORT_CHOICES: dict = {} ABOUT_CHOICES: dict = {} + NEWS_CHOICES: dict = {} COMMAND_SEPARATOR = "/" KEYS_MENU = "keys" + COMMAND_SEPARATOR TRY_RELOAD = False @@ -160,6 +161,7 @@ def __init__(self, queue: List[str] = None) -> None: c for c in self.controller_choices if c not in self.CHOICES_COMMON ] + # Add in support options support_choices: dict = {c: {} for c in self.controller_choices} support_choices = {c: None for c in (["generic"] + self.support_commands)} @@ -174,6 +176,10 @@ def __init__(self, queue: List[str] = None) -> None: self.SUPPORT_CHOICES = support_choices + # Add in news options + news_choices = ["--term", "-t", "--sources", "-s", "--help", "-h"] + self.NEWS_CHOICES = {c: None for c in news_choices} + def check_path(self) -> None: """Check if command path is valid.""" path = self.PATH diff --git a/openbb_terminal/terminal_controller.py b/openbb_terminal/terminal_controller.py index 5df3afe4d2b8..346f3eea2514 100644 --- a/openbb_terminal/terminal_controller.py +++ b/openbb_terminal/terminal_controller.py @@ -151,6 +151,7 @@ def update_runtime_choices(self): choices: dict = {c: {} for c in self.controller_choices} choices["support"] = self.SUPPORT_CHOICES choices["exe"] = self.ROUTINE_CHOICES + choices["news"] = self.NEWS_CHOICES self.completer = NestedCompleter.from_nested_dict(choices)