Commands

Command System

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.

Overview

Angreal’s command system consists of:

  • Commands - Individual operations that can be executed from the command line
  • Command Groups - Collections of related commands
  • Arguments - Parameters that commands can accept

Key Components

ComponentDescriptionDocumentation
@commandDecorator to define a commandAPI Reference
@command_groupDecorator to create a group of commandsAPI Reference
@argumentDecorator to add arguments to commandsAPI Reference

Comprehensive Guide

For a complete walkthrough of creating commands and arguments, see the Command System Guide.

Examples

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}")