Skip to content

Commit

Permalink
Adds auto completion to news (#4089)
Browse files Browse the repository at this point in the history
* 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 d5dbf31.

* 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 <jmaslek11@gmail.com>
  • Loading branch information
4 people authored Jan 31, 2023
1 parent 003a5c8 commit a040fe7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions openbb_terminal/parent_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)}
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions openbb_terminal/terminal_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit a040fe7

Please sign in to comment.