diff --git a/cli/openbb_cli/config/menu_text.py b/cli/openbb_cli/config/menu_text.py index c2b98922c84..72e888569b1 100644 --- a/cli/openbb_cli/config/menu_text.py +++ b/cli/openbb_cli/config/menu_text.py @@ -180,6 +180,9 @@ class MenuText: if description == self.menu_path + name: description = "" + if len(description) > self.CMD_DESCRIPTION_LENGTH: + description = description[: self.CMD_DESCRIPTION_LENGTH - 3] + "..." + menu = f"{name}{spacing}{description}" tag = "unvl" if disable else "menu" self.menu_text += f"[{tag}]> {menu}[/{tag}]\n" diff --git a/cli/openbb_cli/controllers/base_platform_controller.py b/cli/openbb_cli/controllers/base_platform_controller.py index ee5ac189106..73d5e4e0f4d 100644 --- a/cli/openbb_cli/controllers/base_platform_controller.py +++ b/cli/openbb_cli/controllers/base_platform_controller.py @@ -274,13 +274,26 @@ class PlatformController(BaseController): def _get_menu_description(self, menu: str) -> str: """Get menu description.""" + + def _get_sub_menu_commands(): + """Get sub menu commands.""" + sub_path = f"{self.PATH[1:].replace('/','_')}{menu}" + commands = [] + for trl in self.translators: + if sub_path in trl: + commands.append(trl.replace(f"{sub_path}_", "")) + return commands + menu_description = ( obb.reference["routers"] # type: ignore .get(f"{self.PATH}{menu}", {}) .get("description", "") ) or "" + if menu_description: + return menu_description.split(".")[0].lower() - return menu_description.split(".")[0].lower() + # If no description is found, return the sub menu commands + return ", ".join(_get_sub_menu_commands()) def print_help(self): """Print help."""