Files
dragonion-server/dragonion_server/cli/utils/groups.py
2023-07-02 11:54:49 +03:00

19 lines
513 B
Python

import click
import typing as t
class ModuleGroup(click.Group):
def __init__(
self,
name: t.Optional[str] = None,
commands: t.Optional[
t.Union[t.Dict[str, click.Command], t.Sequence[click.Command]]
] = None,
**attrs: t.Any,
) -> None:
new_commands = dict()
for command_key in commands.keys():
new_commands[f'{name}-{command_key}'] = commands[command_key]
super().__init__(name, new_commands, **attrs)