Skip to content

fix_command

appimage_updater.commands.fix_command

Fix command implementation for repairing managed symlinks and .info files.

logger = logging.getLogger(__name__) module-attribute

FixCommand(params)

Command to repair managed symlinks and .info files for a single app.

Source code in src/appimage_updater/commands/fix_command.py
def __init__(self, params: FixParams):
    super().__init__()
    self.params = params

params = params instance-attribute

execute(output_formatter=None) async

Execute the fix command.

Source code in src/appimage_updater/commands/fix_command.py
async def execute(self, output_formatter: Any = None) -> CommandResult:
    """Execute the fix command."""
    configure_logging(debug=self.params.debug)

    try:
        validation_result = self._handle_validation_errors()
        if validation_result:
            return validation_result

        success = await self._execute_fix_operation()

        return CommandResult(success=success, exit_code=0 if success else 1)

    except Exception as e:  # pragma: no cover - defensive logging
        # Handle typer.Exit properly
        if isinstance(e, typer.Exit):
            return CommandResult(success=False, message="Command failed", exit_code=e.exit_code)

        logger.error(f"Unexpected error in fix 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/fix_command.py
def validate(self) -> list[str]:
    """Validate command parameters."""
    errors: list[str] = []

    if not self.params.app_name:
        errors.append("An application name is required")

    return errors