-
Notifications
You must be signed in to change notification settings - Fork 26
CommandLine
Last revision: ver. 4.1-alpha6 - 18 July 2013
All omegalib applications (yes, even the ones you create) support a few predefined command line arguments. If you application needs more, you can also add custom ones.
The predefined command line syntax of an omegalib application is:
omegaApp [-c configFile] [-?] [-K] [-D path] [-L path] [-I <tx>,<ty>,<tw>,<th>,<portPool>] [-m <default|client|server>]
-
configFile
: is the configuration file to use with this application (default: same as the application name with a .cfg extention, or default.cfg if the previous is not found) -
-?
: prints the full command line reference (predefined AND custom options) -
-K
: kill all application instances, when running on a cluster system -
-D path
: changes the default omegalib data path see the filesystem page for more information -
-L path
: changes the path of the application log file (default: same as the application name with a .log extention) -
-I <tx>,<ty>,<tw>,<th>,<portPool>
: (version 3.7+) sets up multi-instance mode. See the Multi-Instance Guide for more information. -
--m <default|client|@host[:port]|server|disable>
: (version 3.7+) sets the mission control mode. Read more in the section below.
The --mc
switch speciies the mission control mode for the application. Mission control allows applications to receive remote commands and create connections to each other to support collaborative applications. See the Mission Control Wiki Page for more information about Mission Control.
The configuration of mission control is specified in the system configuration file (see [The --mc
flag supports four modes:
-
default
: this is the default mode (not entering the--mc
switch is the same as entering--mc default
). In this mode the application checks theserverEnabled
variable in the system configuration, and if set to true opens a mission control server on the port specified in the system configuration (port
variable), or using default port 22500. -
server
: same as default but forces the creation of a server even ifserverEnabled
is set to false in the configuration file. -
client
: this option sets up the application as a mission control client, and attempts connection to a server using theserverHost
andport
variables in the system configuration file. By default, it will try connecting to a local server on the default port -
@host[:port]
: sets up a mission control client and attempts connecting to a server at the specified host (and optional port if different from default) -
disable
: disables mission control
You can create additional command line arguments for your application, right before calling omain
:
int main(int argc, char** argv)
{
String argString;
bool argFlag;
Application<MyApplication> app("myapp");
oargs().newNamedString('s', "string", "string", "a custom string", argString);
oargs().newFlag('f', "flag", "a custom flag", argFlag);
return omain(app, argc, argv);
}
the oargs()
function uses the ArgumentHelper
class to perform argument parsing. More information about ArgumentHelper
can be found http://graphics.stanford.edu/~drussel/Argument_helper/ here.).