httk.core.register.cli¶
Command-line registry and command metadata.
Attributes¶
Classes¶
Store registration metadata for one top-level httk command. |
Functions¶
|
Register a lazy top-level httk command. |
Return registered top-level command names without resolving handlers. |
|
|
Return command metadata without importing its implementation. |
Module Contents¶
- class httk.core.register.cli.CLICommand[source]¶
Store registration metadata for one top-level httk command.
- Parameters:
name – The lowercase hyphen-separated command name.
handler – The command callable or lazy reference.
summary – The one-line command summary.
- handler: str | collections.abc.Callable[Ellipsis, Any][source]¶
- httk.core.register.cli.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
handleris neither callable nor a lazy reference.ValueError – If the name, handler reference, summary, or registration is invalid.
- httk.core.register.cli.known_cli_commands()[source]¶
Return registered top-level command names without resolving handlers.
- httk.core.register.cli.cli_command(name)[source]¶
Return command metadata without importing its implementation.
- Parameters:
name (str) – The command name to look up.
- Returns:
Command metadata, or
Noneif it is not registered.- Return type:
CLICommand | None