A component that facilitates the creation of console commands in Parser3.
The preferred method of installation is throw parsekit
parsekit require ln-e/consoleDo not forget to use vault/classpath.p in auto.p
^use[./vault/classpath.p]
Create application and configure commands
$app[^Application::create[]]
^app.register[^SomeCommand::create[]]
^app.register[^SomeOtherCommand::create[]]
$result[$result^app.run[]]
Or you can extend Application class and implement loading commands as you need. I.e. load all *Command.p files in some directory:
@CLASS
Application
@OPTIONS
locals
@auto[]
$Application:options[^hash::create[]]
###
#------------------------------------------------------------------------------
#Configures list of available commands
#------------------------------------------------------------------------------
@configureCommands[][result]
# implement getting available commands such as
$files[^file:list[./Commands/;\sCommand.p]]
^files.menu{
^self.register[^reflection::create[^list.replace[.p;];create]]
}
###