The command system allows you to create CLI commands for your Angreal projects. Commands are defined using Python decorators and can be grouped into logical categories.
Angreal’s command system consists of:
Component | Description | Documentation |
---|---|---|
@command | Decorator to define a command | API Reference |
@command_group | Decorator to create a group of commands | API Reference |
@argument | Decorator to add arguments to commands | API Reference |
For a complete walkthrough of creating commands and arguments, see the Command System Guide.
import angreal
# Define a command group
dev = angreal.command_group(name="dev", about="Development commands")
# Create a command in the group
@dev()
@angreal.command(name="build", about="Build the project")
@angreal.argument(name="target", long="target", takes_value=True,
help="Build target", default_value="debug")
def build_command(target):
"""Build the project for the specified target."""
print(f"Building project for target: {target}")