clan-cli: Refactor the API to use the Flake object

This commit is contained in:
Qubasa
2025-05-07 13:12:43 +02:00
parent c21262b52d
commit a6a69bb09b
31 changed files with 168 additions and 136 deletions

View File

@@ -2,20 +2,21 @@ from dataclasses import dataclass
from clan_lib.api import API
from clan_cli.flake import Flake
from clan_cli.inventory import Inventory, Meta, load_inventory_json, set_inventory
@dataclass
class UpdateOptions:
directory: str
flake: Flake
meta: Meta
@API.register
def update_clan_meta(options: UpdateOptions) -> Inventory:
inventory = load_inventory_json(options.directory)
inventory = load_inventory_json(options.flake)
inventory["meta"] = options.meta
set_inventory(inventory, options.directory, "Update clan metadata")
set_inventory(inventory, options.flake, "Update clan metadata")
return inventory