Skip to content
Draft
2 changes: 2 additions & 0 deletions cli/integration/test_commands.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"""Integration tests for CLI commands."""

import io

import pytest
Expand Down
3 changes: 2 additions & 1 deletion cli/integration/test_integration_base_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def test_check_path_invalid(base_controller):
def test_parse_input(base_controller):
"""Test the parse_input method."""
input_str = "/equity/price/help"
expected_output = ["equity", "price", "help"]
# Leading '/' prepends "home" to navigate to root first
expected_output = ["home", "equity", "price", "help"]
assert (
base_controller.parse_input(input_str) == expected_output
), "Input parsing failed"
Expand Down
1 change: 1 addition & 0 deletions cli/openbb_cli/argparse_translator/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Argparse translator package."""
8 changes: 4 additions & 4 deletions cli/openbb_cli/argparse_translator/obbject_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def register(self, obbject: OBBject) -> bool:
if (
isinstance(obbject, OBBject)
and not self._contains_obbject(obbject.id, self._obbjects)
and obbject.results
and obbject.results is not None
):
self._obbjects.append(obbject)
return True
Expand Down Expand Up @@ -85,11 +85,11 @@ def _handle_standard_params(obbject: OBBject) -> str:
def _handle_data_repr(obbject: OBBject) -> str:
"""Handle data representation for obbjects."""
data_repr = ""
if hasattr(obbject, "results") and obbject.results:
if hasattr(obbject, "results") and obbject.results is not None:
data_schema = (
obbject.results[0].model_json_schema()
if obbject.results
and isinstance(obbject.results, list)
if isinstance(obbject.results, list)
and len(obbject.results) > 0
and hasattr(obbject.results[0], "model_json_schema")
else ""
)
Expand Down
25 changes: 1 addition & 24 deletions cli/openbb_cli/config/menu_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,30 +60,7 @@ def _get_providers(command_path: str) -> list:
return []

def _format_cmd_name(self, name: str) -> str:
"""Truncate command name length if it is too long."""
if len(name) > self.CMD_NAME_LENGTH:
new_name = name[: self.CMD_NAME_LENGTH]

if "_" in name:
name_split = name.split("_")

new_name = (
"_".join(name_split[:2]) if len(name_split) > 2 else name_split[0]
)

if len(new_name) > self.CMD_NAME_LENGTH:
new_name = new_name[: self.CMD_NAME_LENGTH]

if new_name != name:
self.warnings.append(
{
"warning": "Command name too long",
"actual command": f"`{name}`",
"displayed command": f"`{new_name}`",
}
)
name = new_name

"""Return command name as-is without truncation."""
return name

def _format_cmd_description(
Expand Down
2 changes: 1 addition & 1 deletion cli/openbb_cli/config/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@


def bootstrap():
"""Setup pre-launch configurations for the CLI."""
"""Set up pre-launch configurations for the CLI."""
SETTINGS_DIRECTORY.mkdir(parents=True, exist_ok=True)
Path(ENV_FILE_SETTINGS).touch(exist_ok=True)
Loading
Loading