dockge-cli/dockge_cli/client/commandprovider/factory.py
Firq d3e5d4ae56
All checks were successful
/ backend-pylint (push) Successful in 13s
/ build-artifacts (push) Successful in 8s
/ publish-artifacts (push) Successful in 20s
Improved typing, refactored code, fixed some issues
2024-07-04 22:12:36 +02:00

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 })