toolr._registry¶
CommandGroup ¶
Bases: Struct
A group of commands under a common namespace.
command ¶
Register a new command.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str | F
|
Name of the command. If not passed, the function name will be used. |
required |
Returns:
Type | Description |
---|---|
Callable[[F], F] | F
|
A decorator function that registers the command |
Source code in python/toolr/_registry.py
command_group ¶
command_group(
name: str,
title: str,
description: str | None = None,
long_description: str | None = None,
docstring: str | None = None,
) -> CommandGroup
Create a nested command group within this group.
This is a wrapper around the command_group function that sets the parent to this group's full name.
Returns:
Type | Description |
---|---|
CommandGroup
|
A CommandGroup instance |
Source code in python/toolr/_registry.py
get_commands ¶
CommandRegistry ¶
command_group ¶
command_group(
name: str,
title: str,
description: str | None = None,
long_description: str | None = None,
docstring: str | None = None,
parent: str | None = None,
) -> CommandGroup
Register a new command group.
If you pass docstring
, you won't be allowed to pass description
or long_description
.
Those will be parsed by docstring-parser.
The first line of the docstring will be used as the description, the rest will be used as the long description.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
Name of the command group |
required |
title
|
str
|
Title for the command group |
required |
description
|
str | None
|
Description for the command group |
None
|
long_description
|
str | None
|
Long description for the command group |
None
|
docstring
|
str | None
|
Docstring for the command group |
None
|
parent
|
str | None
|
Optional parent command path using dot notation (e.g. "tools.docker.build") |
None
|
Returns:
Type | Description |
---|---|
CommandGroup
|
A CommandGroup instance |