Skip to content

config_command

appimage_updater.commands.config_command

Config command implementation.

ConfigCommand(params)

Command to manage global configuration settings.

Source code in src/appimage_updater/commands/config_command.py
def __init__(self, params: ConfigParams):
    self.params = params
    self.console = Console()

console = Console() instance-attribute

params = params instance-attribute

execute(output_formatter=None) async

Execute the config command.

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

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

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

        return self._create_result(success)

    except Exception as e:
        logger.error(f"Unexpected error in config 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/config_command.py
def validate(self) -> list[str]:
    """Validate command parameters."""
    errors = []
    errors.extend(self._validate_action())
    errors.extend(self._validate_set_action_parameters())
    errors.extend(self._validate_show_effective_parameters())
    return errors