diff --git a/cli.py b/cli.py index 4ae4c6f7029..ab0b2ab774a 100644 --- a/cli.py +++ b/cli.py @@ -9629,7 +9629,7 @@ class HermesCLI(CLIAgentSetupMixin, CLICommandsMixin): show_full = state.get("show_full", False) title = "⚠️ Dangerous Command" - cmd_display = command if show_full or len(command) <= 70 else command[:70] + '...' + cmd_display = command choice_labels = { "once": "Allow once", "session": "Allow for this session", @@ -9653,6 +9653,8 @@ class HermesCLI(CLIAgentSetupMixin, CLICommandsMixin): # Pre-wrap the mandatory content — command + choices must always render. cmd_wrapped = _wrap_panel_text(cmd_display, inner_text_width) + if not show_full and "view" in choices and len(cmd_wrapped) > 4: + cmd_wrapped = cmd_wrapped[:3] + ["… (choose Show full command)"] # (choice_index, wrapped_line) so we can re-apply selected styling below choice_wrapped: list[tuple[int, str]] = [] diff --git a/tests/cli/test_cli_approval_ui.py b/tests/cli/test_cli_approval_ui.py index df7c06a2d00..aeae5d92af1 100644 --- a/tests/cli/test_cli_approval_ui.py +++ b/tests/cli/test_cli_approval_ui.py @@ -154,7 +154,9 @@ class TestCliApprovalUi: assert "Dangerous Command" not in lines[0] assert any("Dangerous Command" in line for line in lines[1:3]) assert "Show full command" in rendered - assert "githubcli-archive-keyring.gpg" not in rendered + assert "githubcli-archive-" in rendered + assert "keyring.gpg" in rendered + assert "status=progress" in rendered def test_approval_display_shows_full_command_after_view(self): cli = _make_cli_stub()