Command to show application details.
Source code in src/appimage_updater/commands/show_command.py
| def __init__(self, params: ShowParams):
self.params = params
self.console = Console()
|
console = Console()
instance-attribute
params = params
instance-attribute
execute(output_formatter=None)
async
Execute the show command.
Source code in src/appimage_updater/commands/show_command.py
| async def execute(self, output_formatter: Any = None) -> CommandResult:
"""Execute the show command."""
configure_logging(debug=self.params.debug)
try:
# Validate required parameters
validation_errors = self.validate()
if validation_errors:
error_msg = f"Validation errors: {', '.join(validation_errors)}"
self.console.print(f"[red]Error: {error_msg}[/red]")
return CommandResult(success=False, message=error_msg, exit_code=1)
# Use context manager to make output formatter available throughout the execution
if output_formatter:
with OutputFormatterContext(output_formatter):
success = await self._execute_show_operation()
else:
success = await self._execute_show_operation()
if success:
return CommandResult(success=True, message="Show completed successfully")
else:
return CommandResult(success=False, message="Applications not found", exit_code=1)
except Exception as e:
logger.error(f"Unexpected error in show command: {e}")
logger.exception("Full exception details")
return CommandResult(success=False, message=str(e), exit_code=1)
|
validate()
Validate command parameters.
Source code in src/appimage_updater/commands/show_command.py
| def validate(self) -> list[str]:
"""Validate command parameters."""
errors = []
if not self.params.app_names:
errors.append("At least one application name is required")
return errors
|