Fix Click deprecation warning, use standard invoke_without_command pattern

This commit is contained in:
n0mad1k
2026-03-19 09:03:41 -04:00
parent 0cfd7dc32d
commit 5d325efc75
+4 -11
View File
@@ -158,17 +158,7 @@ def _load_profiles_fallback() -> list[dict]:
# Click CLI
# ---------------------------------------------------------------------------
class MosaicCLI(click.Group):
"""Custom group that shows the interactive menu when invoked bare."""
def invoke(self, ctx):
if not ctx.protected_args and not ctx.invoked_subcommand:
interactive_menu(ctx)
else:
super().invoke(ctx)
@click.group(cls=MosaicCLI, invoke_without_command=True)
@click.group(invoke_without_command=True)
@click.option("--source", type=str, default=None, help="Source profile name.")
@click.option("--url", type=str, default=None, help="Ad-hoc source URL.")
@click.option("--profile", "profile_path", type=click.Path(exists=True), default=None,
@@ -205,6 +195,9 @@ def cli(ctx, source, url, profile_path, dry_run, retry_failed, since, date_range
ctx.obj["verbose"] = verbose
ctx.obj["output_dir"] = get_output_dir(cfg)
if ctx.invoked_subcommand is None:
interactive_menu(ctx)
# ---------------------------------------------------------------------------
# collect