18 lines
434 B
Python
18 lines
434 B
Python
from typing import List, Callable
|
|
from pydantic import BaseModel
|
|
from .descriptors import command_mappings
|
|
|
|
class Command(BaseModel):
|
|
command: str
|
|
description: str
|
|
args: int
|
|
optional: bool
|
|
binding: Callable
|
|
|
|
commands: dict[str, Command] = {}
|
|
descriptors: List[dict[str, object]] = command_mappings
|
|
|
|
for descriptor in descriptors:
|
|
c = Command(**descriptor) # type: ignore
|
|
commands.update({ c.command: c })
|