Skip to content

registry

registry

Every subcommand terok-shield exposes — arguments, handler, and help text.

The COMMANDS tuple is the single source of truth consumed by both the standalone CLI and the terok integration layer. Handler functions accept (shield, container?, **kwargs) and print to stdout, making them reusable across different CLI frontends.

ArgDef(name, help='', type=None, default=None, action=None, dest=None, nargs=None) dataclass

Definition of a single CLI argument for a command.

CommandDef(name, help='', handler=None, needs_container=False, args=(), standalone_only=False) dataclass

Definition of a shield subcommand.

Attributes:

Name Type Description
name str

Subcommand name (e.g. "allow").

help str

One-line help string for --help.

handler Callable[..., None] | None

Callable that implements the command logic.

needs_container bool

Whether the command requires a container positional arg.

args tuple[ArgDef, ...]

Extra arguments beyond the implicit container.

standalone_only bool

If True, only available in the standalone CLI, not via terok.