diff --git a/elementary/cli/cli.py b/elementary/cli/cli.py index 6253b3746..0bbf24aa9 100644 --- a/elementary/cli/cli.py +++ b/elementary/cli/cli.py @@ -36,20 +36,10 @@ def get_quiet_logs(ctx): return False -class ElementaryCLI(click.MultiCommand): # type: ignore[misc, valid-type] - _CMD_MAP = { - "monitor": monitor, - "report": report, - "send-report": send_report, - "run-operation": run_operation, - } - - def list_commands(self, ctx): - return self._CMD_MAP.keys() - +class ElementaryCLI(click.Group): def get_command(self, ctx, name): ctx.auto_envvar_prefix = "EDR" - return self._CMD_MAP.get(name) + return super().get_command(ctx, name) def format_help(self, ctx, formatter): try: @@ -75,7 +65,7 @@ def invoke(self, ctx: click.Context) -> Any: return super().invoke(ctx) -@click.command( +@click.group( cls=ElementaryCLI, help="Open source data reliability solution (https://docs.elementary-data.com/)", ) @@ -87,5 +77,11 @@ def cli(): pass +cli.add_command(monitor) +cli.add_command(report) +cli.add_command(send_report, name="send-report") +cli.add_command(run_operation, name="run-operation") + + if __name__ == "__main__": cli()