Skip to content

introspect_cappa

Class info

🛈 DocStrings

Introspection module for cappa CLI applications.

get_info

get_info(cls: type[Any], command: str | None = None) -> CommandInfo

Extract CLI information from a cappa command class.

Parameters:

Name Type Description Default
cls type[Any]

The (dataclass-like) command class to analyze

required
command str | None

The command to get info for (supports dot notation for subcommands).

None
Source code in src/clinspector/introspect/introspect_cappa.py
def get_info(cls: type[Any], command: str | None = None) -> commandinfo.CommandInfo:
    """Extract CLI information from a cappa command class.

    Args:
        cls: The (dataclass-like) command class to analyze
        command: The command to get info for (supports dot notation for subcommands).
    """
    collected = cappa.collect(cls, help=False, completion=False)
    return resolve_command(_parse_command(collected), command)