Athena::Console::Loader::Factory
Inherits Athena::Console::Loader::Interface / Struct / Value / Object
A default implementation of ACON::Loader::Interface that accepts a Hash(String, Proc(ACON::Command)).
A factory could then be set on the ACON::Application:
application = MyCustomApplication.new "My CLI"
application.command_loader = Athena::Console::Loader::Factory.new({
"command1" => Proc(ACON::Command).new { Command1.new },
"app:create-user" => Proc(ACON::Command).new { CreateUserCommand.new },
})
application.run
Constructors
new(factories : Hash(String, Proc(ACON::Command)))
SourceInstance methods
get(name : String) : ACON::Command
Returns an ACON::Command with the provided name.
Raises ACON::Exception::CommandNotFound if it is not defined.
has?(name : String) : Bool
Returns true if self has a command with the provided name, otherwise false.