class

AzuCLI::Commands::Base

Inherits Reference < Object

Base command class for all Azu CLI commands

Constructors

new(name : String, description : String = "")
Source

Instance methods

all_args
Source
all_args=(all_args : Array(String))
Source
args
Source
args=(args : Array(String))
Source
description
Source
description=(description : String)
Source
error(message : String, category : String) : Result

Error result with category

Source
error(message : String) : Result

Error result

Source
execute

Abstract method that all commands must implement

Source
fatal_error(message : String, category : String = Config::ErrorCategory::UNKNOWN) : NoReturn

Handle fatal error (always exits)

Source
filesystem_error(message : String, category : String = Config::ErrorCategory::IO_ERROR) : Result

Handle file system error

Source
get_arg(index : Int32) : String | Nil

Get argument at index

Source
get_args

Get all arguments (including flags)

Source
get_option(key : String, default : String = "") : String

Get option value with default

Source
handle_error(message : String, category : String = Config::ErrorCategory::UNKNOWN, severity : Int32 = Config::ErrorSeverity::ERROR, exit_code : Int32 = Config::EXIT_FAILURE, should_exit : Bool = false) : Result

Handle error with proper logging and optional exit

Source
has_option?(key : String) : Bool

Check if option is set

Source
name
Source
name=(name : String)
Source
options
Source
options=(options : Hash(String, String))
Source
parse_args(args : Array(String))

Parse command line arguments using Crystal's OptionParser

Source
show_examples

Show command examples - can be overridden by subclasses

Source
show_help

Show help for this command

Source
success(message : String = "") : Result

Success result

Source
validate_required_args(required_count : Int32) : Bool

Validate required arguments

Source
validate_required_options(required_options : Array(String)) : Bool

Validate required options

Source
validation_error(message : String) : Result

Handle validation error with proper context

Source
warning(message : String, category : String = Config::ErrorCategory::UNKNOWN)

Handle warning (logs but doesn't fail)

Source
with_error_handling(category : String = Config::ErrorCategory::RUNTIME_ERROR, &)

Wrap exception handling with consistent error reporting

Source