-
Notifications
You must be signed in to change notification settings - Fork 168
How to Create a Run Mode
Tim Olson edited this page Jun 23, 2014
·
3 revisions
JCommander is a command-line parser which makes it easy to attach command-line parameters to Java fields by using annotations. The Main class automatically discovers any subclasses of org.ccp.RunMode, then instantiates them with the root Injector, then registers the run mode instances with JCommander. After JCommander has parsed the command-line, Main then invokes the run() method of the chosen RunMode.
- Subclass
org.ccp.RunModeBase(or implementorg.ccp.RunMode) - Specify the command-line command name by putting this JCommander annotation above the class:
@Parameters(commandNames="my-command”) - Use the singular
@Parametertag on any fields in your subclass to capture command-line info (see the JCommander docs) - Implement the
run()method