Skip to content

remove_command

appimage_updater.commands.remove_command

Remove command implementation.

logger = logging.getLogger(__name__) module-attribute

RemoveCommand(params)

Command to remove applications from configuration.

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

params = params instance-attribute

execute(output_formatter=None) async

Execute the remove command.

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

    try:
        # Validate required parameters
        validation_result = self._handle_validation_errors()
        if validation_result:
            return validation_result

        # Use context manager to make output formatter available throughout the execution
        with OutputFormatterContext(output_formatter):
            success = await self._execute_remove_operation()

        return success

    except Exception as e:
        # Handle typer.Exit from ApplicationService properly
        if isinstance(e, typer.Exit):
            return CommandResult(success=False, message="Command failed", exit_code=e.exit_code)

        logger.error(f"Unexpected error in remove 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/remove_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