This constructor only sets up the internal state of the class, but does not call any extension or user code.
Run implementation that forwards to the abstract run(Arguments, ConfigParser).
This method must be implemented by subclasses to do the actual application work.
IArgumentsExtExtension methods dummy implementation.
Struct containing optional constructor arguments. There are enough of these that handling them as default arguments to the ctor is cumbersome.
Command line arguments used by the application.
Command line arguments extension used by the application.
Extension to start run method inside a task.
Version information.
Version information extension.
Adds a list of extensions (this.extensions) and methods to handle them. See ExtensibleClassMixin documentation for details.
Alias of Application, for use by sub-classes without needing to import ocean.util.app.Application.
Short description of the application.
Command line arguments passed to the application.
Application exit status code.
Exit cleanly from the application.
Runs the application.
Prints the message in an ExitException.
Do the actual application work.
Default application extension order.
IApplicationExtension methods dummy implementation.
Function executed when command line arguments are set up (before parsing).
Function executed after parsing of command line args (whether the basic parsing failed or succeeded) but before the call to validateArgs().
Function executed after parsing the command line arguments.
Function executed after (successfully) validating the command line arguments.
1 /*************************************************************************** 2 3 Example CLI application class. 4 5 ***************************************************************************/ 6 7 class MyApp : CliApp 8 { 9 this ( ) 10 { 11 // The name of your app and a short description of what it does. 12 istring name = "my_app"; 13 istring desc = "Dummy app for unittest."; 14 15 // The version info for your app. Normally you get this by importing 16 // Version and passing the AA which contains the version info 17 // (called Version) to CliApp's constructor. 18 auto ver = VersionInfo.init; 19 20 // You may also pass an instance of OptionalSettings to CliApp's 21 // constructor, to specify non-mandatory options. In this example, 22 // we specify the help text. 23 CliApp.OptionalSettings settings; 24 settings.help = "Actually, this program does nothing. Sorry!"; 25 26 // Call the super class' ctor. 27 super(name, desc, ver, settings); 28 } 29 30 // Called after arguments and config file parsing. 31 override protected int run ( Arguments args ) 32 { 33 // Application main logic. 34 35 return 0; // return code to OS 36 } 37 } 38 39 /*************************************************************************** 40 41 Your application's main() function should look something like this. 42 (This function is not called here as we don't want to actually run the 43 application in this unittest.) 44 45 ***************************************************************************/ 46 47 int main ( istring[] cl_args ) 48 { 49 // Instantiate an instance of your app class. 50 auto my_app = new MyApp; 51 52 // Pass the raw command line arguments to its main function. 53 auto ret = my_app.main(cl_args); 54 55 // Return ret to the OS. 56 return ret; 57 }
CliApp class