httk.registry.cli.core

Functions

register_cli_command(name, handler, summary)

Register a lazy top-level httk command.

Package Contents

httk.registry.cli.core.register_cli_command(name, handler, summary)[source]

Register a lazy top-level httk command.

A handler is either a callable or a lazy "module:callable" reference with the contract (argv: Sequence[str], context: CLIContext) -> int. Names use lowercase, hyphen-separated command syntax. Registration is intentionally strict: reserved names and duplicate registrations are errors rather than order-dependent overrides.

Parameters:
  • name (str) – The lowercase hyphen-separated command name.

  • handler (str | collections.abc.Callable[Ellipsis, Any]) – The command callable or lazy "module:callable" reference.

  • summary (str) – The nonempty one-line command summary.

Raises:
  • TypeError – If handler is neither callable nor a lazy reference.

  • ValueError – If the name, handler reference, summary, or registration is invalid.