Classgen: add mapped keys and more stuff
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
from dataclasses import dataclass
|
||||
|
||||
from clan_cli.api import API
|
||||
from clan_cli.inventory import Inventory, InventoryMeta
|
||||
from clan_cli.inventory import Meta, load_inventory, save_inventory
|
||||
|
||||
|
||||
@dataclass
|
||||
class UpdateOptions:
|
||||
directory: str
|
||||
meta: InventoryMeta
|
||||
meta: Meta
|
||||
|
||||
|
||||
@API.register
|
||||
def update_clan_meta(options: UpdateOptions) -> InventoryMeta:
|
||||
inventory = Inventory.load_file(options.directory)
|
||||
def update_clan_meta(options: UpdateOptions) -> Meta:
|
||||
inventory = load_inventory(options.directory)
|
||||
inventory.meta = options.meta
|
||||
|
||||
inventory.persist(options.directory, "Update clan meta")
|
||||
save_inventory(inventory, options.directory, "Update clan metadata")
|
||||
|
||||
return inventory.meta
|
||||
|
||||
Reference in New Issue
Block a user