Coverage for src/commands/help.py: 100%
15 statements
« prev ^ index » next coverage.py v7.8.0, created at 2025-06-05 22:56 -0700
« prev ^ index » next coverage.py v7.8.0, created at 2025-06-05 22:56 -0700
1"""
2Command handler for displaying help information.
4This module contains the handler for displaying help about
5available commands.
6"""
8import logging
9from typing import Optional
11from src.clients.databricks import DatabricksAPIClient
12from src.command_registry import CommandDefinition, get_user_commands, TUI_COMMAND_MAP
13from .base import CommandResult
16def handle_command(client: Optional[DatabricksAPIClient], **kwargs) -> CommandResult:
17 """
18 Display help information about available commands.
20 Args:
21 client: API client instance (not used by this handler)
22 **kwargs: No parameters required
23 """
24 try:
25 from src.ui.help_formatter import format_help_text
27 user_commands = get_user_commands()
28 help_text = format_help_text(user_commands, TUI_COMMAND_MAP)
29 return CommandResult(True, data={"help_text": help_text})
30 except Exception as e:
31 logging.error(f"Error generating help: {e}", exc_info=True)
32 return CommandResult(False, error=e, message="Error generating help text.")
35DEFINITION = CommandDefinition(
36 name="help",
37 description="Display help information about available commands",
38 handler=handle_command,
39 parameters={},
40 required_params=[],
41 tui_aliases=["/help"],
42 visible_to_user=True,
43 visible_to_agent=True,
44)