Skip to main content

hackagent.interfaces.cli.utils

CLI Utilities

Common utilities for the HackAgent CLI including error handling, formatting, and helper functions.

handle_errors​

def handle_errors(func)

Decorator for consistent error handling across CLI commands

load_config_file​

def load_config_file(path: str) -> Dict[str, Any]

Load configuration from YAML or JSON file

display_results_table​

def display_results_table(results: Any, title: str = "Results") -> None

Display results in a formatted table

display_success​

def display_success(message: str) -> None

Display success message with formatting

display_warning​

def display_warning(message: str) -> None

Display warning message with formatting

display_error​

def display_error(message: str) -> None

Display error message with formatting

display_info​

def display_info(message: str) -> None

Display info message with formatting

confirm_action​

def confirm_action(message: str, default: bool = False) -> bool

Get user confirmation for dangerous actions

format_duration​

def format_duration(seconds: float) -> str

Format duration in seconds to human readable format

create_status_panel​

def create_status_panel(title: str,
content: str,
status: str = "info") -> Panel

Create a status panel with appropriate styling

launch_tui​

def launch_tui(cli_config,
initial_tab: str = "dashboard",
initial_data: dict = None)

Launch the TUI application with specified tab and optional initial data

Arguments:

  • cli_config - CLI configuration object
  • initial_tab - Which tab to show initially (default: "dashboard")
  • initial_data - Initial data to pre-fill in the tab (default: None)