abstract class
AzuCLI::Commands::Base
- AzuCLI::Commands::Base
- Reference
- Object
Overview
Base command class for all Azu CLI commands
Direct Known Subclasses
- AzuCLI::Commands::Database
- AzuCLI::Commands::Generate
- AzuCLI::Commands::Help
- AzuCLI::Commands::Init
- AzuCLI::Commands::Jobs::Base
- AzuCLI::Commands::New
- AzuCLI::Commands::OpenAPI::Export
- AzuCLI::Commands::OpenAPI::Generate
- AzuCLI::Commands::Plugin
- AzuCLI::Commands::Serve
- AzuCLI::Commands::Session::Clear
- AzuCLI::Commands::Session::Setup
- AzuCLI::Commands::Test
- AzuCLI::Commands::Version
Defined in:
azu_cli/commands/base.crConstructors
Instance Method Summary
- #all_args : Array(String)
- #all_args=(all_args : Array(String))
- #args : Array(String)
- #args=(args : Array(String))
- #description : String
- #description=(description : String)
-
#error(message : String, category : String) : Result
Error result with category
-
#error(message : String) : Result
Error result
-
#execute : Result
Abstract method that all commands must implement
-
#fatal_error(message : String, category : String = Config::ErrorCategory::UNKNOWN) : NoReturn
Handle fatal error (always exits)
-
#filesystem_error(message : String, category : String = Config::ErrorCategory::IO_ERROR) : Result
Handle file system error
-
#get_arg(index : Int32) : String | Nil
Get argument at index
-
#get_args : Array(String)
Get all arguments (including flags)
-
#get_option(key : String, default : String = "") : String
Get option value with default
-
#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
-
#has_option?(key : String) : Bool
Check if option is set
- #name : String
- #name=(name : String)
- #options : Hash(String, String)
- #options=(options : Hash(String, String))
-
#parse_args(args : Array(String))
Parse command line arguments using Crystal's OptionParser
-
#show_examples
Show command examples - can be overridden by subclasses
-
#show_help
Show help for this command
-
#success(message : String = "") : Result
Success result
-
#validate_required_args(required_count : Int32) : Bool
Validate required arguments
-
#validate_required_options(required_options : Array(String)) : Bool
Validate required options
-
#validation_error(message : String) : Result
Handle validation error with proper context
-
#warning(message : String, category : String = Config::ErrorCategory::UNKNOWN)
Handle warning (logs but doesn't fail)
-
#with_error_handling(category : String = Config::ErrorCategory::RUNTIME_ERROR, &)
Wrap exception handling with consistent error reporting
Constructor Detail
Instance Method Detail
Handle fatal error (always exits)
Handle file system error
Handle error with proper logging and optional exit
Handle validation error with proper context
Handle warning (logs but doesn't fail)
Wrap exception handling with consistent error reporting