fix(remote): keep option choices and optional title in remote -h

Rebuild remote service options from the cli_params choices and multiple fields, and mirror the title argument's required flag, so remote help matches local help.
This commit is contained in:
imSp4rky
2026-09-04 15:55:31 -06:00
parent 235839abc8
commit 55bed4876c
+9 -2
View File
@@ -465,8 +465,12 @@ class Services(click.Group):
help_text = Services.docstring_help(help_text) help_text = Services.docstring_help(help_text)
cli_params = svc_info.get("cli_params") if svc_info else None cli_params = svc_info.get("cli_params") if svc_info else None
title_arg = next(
(p for p in cli_params or [] if p.get("kind") == "argument" and p.get("name") == "title"), None
)
@click.command(name=tag, short_help=short_help, help=help_text) @click.command(name=tag, short_help=short_help, help=help_text)
@click.argument("title", type=str) @click.argument("title", type=str, required=bool(title_arg.get("required", True)) if title_arg else True)
@click.pass_context @click.pass_context
def remote_cli(ctx: click.Context, title: str, **kwargs: object) -> object: def remote_cli(ctx: click.Context, title: str, **kwargs: object) -> object:
from unshackle.core.remote_service import RemoteService, resolve_server from unshackle.core.remote_service import RemoteService, resolve_server
@@ -487,7 +491,10 @@ class Services(click.Group):
kwargs["default"] = param.get("default", False) kwargs["default"] = param.get("default", False)
else: else:
kwargs["default"] = param.get("default") kwargs["default"] = param.get("default")
kwargs["type"] = str choices = param.get("choices")
kwargs["type"] = click.Choice(choices, case_sensitive=False) if choices else str
if param.get("multiple"):
kwargs["multiple"] = True
if param.get("help"): if param.get("help"):
kwargs["help"] = param["help"] kwargs["help"] = param["help"]
remote_cli = click.option(*opts, **kwargs)(remote_cli) remote_cli = click.option(*opts, **kwargs)(remote_cli)