inventory.{cli,api}: use only dictionaries
This commit is contained in:
@@ -63,9 +63,11 @@ def show_clan_meta(uri: str | Path) -> Meta:
|
||||
)
|
||||
|
||||
return Meta(
|
||||
name=clan_meta.get("name"),
|
||||
description=clan_meta.get("description", None),
|
||||
icon=icon_path,
|
||||
{
|
||||
"name": clan_meta.get("name"),
|
||||
"description": clan_meta.get("description"),
|
||||
"icon": icon_path if icon_path else "",
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -73,9 +75,9 @@ def show_command(args: argparse.Namespace) -> None:
|
||||
flake_path = args.flake.path
|
||||
meta = show_clan_meta(flake_path)
|
||||
|
||||
print(f"Name: {meta.name}")
|
||||
print(f"Description: {meta.description or '-'}")
|
||||
print(f"Icon: {meta.icon or '-'}")
|
||||
print(f"Name: {meta.get("name")}")
|
||||
print(f"Description: {meta.get("description", '-')}")
|
||||
print(f"Icon: {meta.get("icon", '-')}")
|
||||
|
||||
|
||||
def register_parser(parser: argparse.ArgumentParser) -> None:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from dataclasses import dataclass
|
||||
|
||||
from clan_cli.api import API
|
||||
from clan_cli.inventory import Meta, load_inventory_json, set_inventory
|
||||
from clan_cli.inventory import Inventory, Meta, load_inventory_json, set_inventory
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -11,10 +11,10 @@ class UpdateOptions:
|
||||
|
||||
|
||||
@API.register
|
||||
def update_clan_meta(options: UpdateOptions) -> Meta:
|
||||
def update_clan_meta(options: UpdateOptions) -> Inventory:
|
||||
inventory = load_inventory_json(options.directory)
|
||||
inventory.meta = options.meta
|
||||
inventory["meta"] = options.meta
|
||||
|
||||
set_inventory(inventory, options.directory, "Update clan metadata")
|
||||
|
||||
return inventory.meta
|
||||
return inventory
|
||||
|
||||
Reference in New Issue
Block a user