Skip to content

application_service

appimage_updater.services.application_service

Application service for filtering and managing applications.

ApplicationService

Service for application-related operations.

filter_apps_by_names(enabled_apps, app_names) staticmethod

Filter applications by multiple names or glob patterns.

Returns:

Type Description
list[Any] | None

List of matching applications, or None if some applications were not found.

Source code in src/appimage_updater/services/application_service.py
@staticmethod
def filter_apps_by_names(enabled_apps: list[Any], app_names: list[str]) -> list[Any] | None:
    """Filter applications by multiple names or glob patterns.

    Returns:
        List of matching applications, or None if some applications were not found.
    """
    logger.debug(f"Filtering applications for: {app_names} (case-insensitive, supports glob patterns)")

    if not app_names:
        return enabled_apps

    all_matches, not_found = ApplicationService._collect_app_matches(enabled_apps, app_names)
    unique_matches = ApplicationService._remove_duplicate_apps(all_matches)

    if not_found:
        success = ApplicationService._handle_apps_not_found(not_found, enabled_apps)
        if not success:
            return None  # Indicate error occurred

    logger.debug(f"Found {len(unique_matches)} unique application(s) matching the criteria")
    return unique_matches