Skip to content

Commit

Permalink
styling adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
hjoaquim committed May 14, 2024
1 parent 29dfc7b commit 71b0c90
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
9 changes: 5 additions & 4 deletions cli/openbb_cli/config/menu_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,17 +99,18 @@ def _format_cmd_description(
else description
)

def add_raw(self, text: str):
def add_raw(self, text: str, left_spacing: bool = False):
"""Append raw text (without translation)."""
self.menu_text += text
if left_spacing:
self.menu_text += f"{self.SECTION_SPACING * ' '}{text}\n"
else:
self.menu_text += text

def add_section(
self, text: str, description: str = "", leading_new_line: bool = False
):
"""Append raw text (without translation)."""
spacing = (self.CMD_NAME_LENGTH - len(text) + self.SECTION_SPACING) * " "
left_spacing = self.SECTION_SPACING * " "
text = f"{left_spacing}{text}"
if description:
text = f"{text}{spacing}{description}\n"

Expand Down
7 changes: 5 additions & 2 deletions cli/openbb_cli/controllers/base_platform_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,11 +326,14 @@ def print_help(self):
)

if session.obbject_registry.obbjects:
mt.add_section("Cached Results:\n", leading_new_line=True)
mt.add_info("\nCached Results")
for key, value in list(session.obbject_registry.all.items())[
: session.settings.N_TO_DISPLAY_OBBJECT_REGISTRY
]:
mt.add_raw(f"\tOBB{key}: {value['command']}\n")
mt.add_raw(
f"[yellow]OBB{key}[/yellow]: {value['command']}\n",
left_spacing=True,
)

session.console.print(text=mt.menu_text, menu=self.PATH)

Expand Down
5 changes: 4 additions & 1 deletion cli/openbb_cli/controllers/cli_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,10 @@ def print_help(self):
for key, value in list(session.obbject_registry.all.items())[ # type: ignore
: session.settings.N_TO_DISPLAY_OBBJECT_REGISTRY
]:
mt.add_raw(f"\tOBB{key}: {value['command']}\n") # type: ignore
mt.add_raw(
f"[yellow]OBB{key}[/yellow]: {value['command']}\n",
left_spacing=True,
)

session.console.print(text=mt.menu_text, menu="Home")
self.update_runtime_choices()
Expand Down

0 comments on commit 71b0c90

Please sign in to comment.