"""Update-Sources Registry."""
from __future__ import annotations

from taninux.update.sources import aur, flatpak, fwupd, pacman
from taninux.update.types import UpdateItem


SOURCES = {
    "pacman": pacman.fetch,
    "aur": aur.fetch,
    "flatpak": flatpak.fetch,
    "fwupd": fwupd.fetch,
}


def fetch_all() -> list[UpdateItem]:
    items: list[UpdateItem] = []
    for fn in SOURCES.values():
        try:
            items += fn()
        except Exception:  # noqa: BLE001
            pass
    return items
