animedex.entry._cli_factory
CLI helpers: shared option decorators, output rendering,
--jq <expr> filter, and the register_subcommand factory used
to bind a Python API function to a Click subcommand without
hand-written wrappers per endpoint.
common_options
- animedex.entry._cli_factory.common_options(func: Callable) Callable[source]
Decorator: attach
--json,--jq,--no-cache,--cache,--rate,--no-sourceflags to a CLI subcommand.--jqfilters the rendered JSON through the bundled jq wheel. A syntactically bad expression, runtime error (e.g.1/0,error("…")), or invalid-JSON input surfaces as a typedApiError(reason="jq-failed"); an uninstalled wheel surfaces asreason="jq-missing"._apply_jqrewraps either asclick.ClickExceptionso the CLI exits non-zero with a clean one-line error rather than a Python traceback.
emit
register_subcommand
- animedex.entry._cli_factory.register_subcommand(group: Group, name: str, fn: Callable, *, help: str | None = None, command_aliases: List[str] = None, guidance_override: str | None = None)[source]
Bind a Python API
fnas a Click subcommand ongroup.Argument inference:
Positional parameters with no default →
click.argument.Keyword parameters with default →
click.option.config/no_cache/cache_ttl/rateare injected viacommon_options()(suppressed from auto-binding).
The wrapped command builds the
Configfrom the common flags and passes it asconfig=.... The function’s return value is rendered viaemit().