Classes
CommandMetadata
dataclass
Metadata for a CLI command.
CommandMetadata
dataclass Metadata for a CLI command.
Attributes
| Name | Type | Description |
|---|---|---|
category |
str |
|
description |
str |
|
examples |
list[str] |
|
requires_site |
bool |
|
requires_build |
bool |
|
tags |
list[str] |
|
aliases |
list[str] |
Methods 1
to_dict
Convert metadata to dictionary.
to_dict
def to_dict(self) -> dict[str, Any]
Convert metadata to dictionary.
Returns
dict[str, Any]
Functions
command_metadata
Decorator to attach metadata to a CLI command.
command_metadata
def command_metadata(category: str = 'general', description: str = '', examples: list[str] | None = None, requires_site: bool = False, requires_build: bool = False, tags: list[str] | None = None, aliases: list[str] | None = None) -> Callable[[F], F]
Decorator to attach metadata to a CLI command.
Parameters 7
| Name | Type | Default | Description |
|---|---|---|---|
category |
str |
'general' |
Command category (e.g., 'build', 'content', 'config', 'dev') |
description |
str |
'' |
Short description of what the command does |
examples |
list[str] | None |
None |
Example usage strings |
requires_site |
bool |
False |
Whether this command requires a site to be loaded |
requires_build |
bool |
False |
Whether this command requires the site to be built first |
tags |
list[str] | None |
None |
Tags for filtering/discovery (e.g., ['dev', 'content', 'quick']) |
aliases |
list[str] | None |
None |
Command aliases (for discovery) |
Returns
Callable[[F], F]
get_command_metadata
Get metadata from a command.
get_command_metadata
def get_command_metadata(cmd: click.Command | Callable[..., Any]) -> CommandMetadata | None
Get metadata from a command.
Parameters 1
| Name | Type | Default | Description |
|---|---|---|---|
cmd |
click.Command | Callable[..., Any] |
— | Click command or callable |
Returns
CommandMetadata if found, None otherwiseCommandMetadata | None
—
list_commands_by_category
List all commands in a group, organized by category.
list_commands_by_category
def list_commands_by_category(group: click.Group) -> dict[str, list[click.Command]]
List all commands in a group, organized by category.
Parameters 1
| Name | Type | Default | Description |
|---|---|---|---|
group |
click.Group |
— | Click group to scan |
Returns
Dictionary mapping category names to lists of commandsdict[str, list[click.Command]]
—
find_commands_by_tag
Find commands that have a specific tag.
find_commands_by_tag
def find_commands_by_tag(group: click.Group, tag: str) -> list[tuple[str, click.Command]]
Find commands that have a specific tag.
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
group |
click.Group |
— | Click group to scan |
tag |
str |
— | Tag to search for |
Returns
List of (command_path, command) tupleslist[tuple[str, click.Command]]
—