Command line arguments handlingHere is how argument handling works in Reflex as of today.
Argument handlers register to the argument manager. Each handler specifies which arguments it can handle by implementing the
The argument manager parses all command line arguments before passing them to the handlers for processing. The order in which the arguments are processed does not depend on their order on the command line, but rather on the priority of the argument handlers, which is indicated by the Example argument handler: public class CmdLineConfigHandler implements ArgumentHandler { public static final Argument USE_ARG = new Argument( "--use", // This is the tag 1, // Number of parameters Argument.syntaxSplit("path"), // Syntax (result is path1:path2:...:pathN) "use given configuration handlers and plugins (jar files or directories)"); // Description public static final Argument USE_CLASS_ARG = new Argument( "--useClasses", 1, Argument.syntaxSplit("class"), "use a given classes as a configuration handler or plugins (must be in the classpath)"); public Argument[] supportedArgs() { return new Argument[]{USE_ARG, USE_CLASS_ARG}; } public int getPriority() { return PRIORITY_META; } public void handleArgs(Map<Argument, List<String>> aArguments) { // The following method retrieves the unique parameter to the USE_ARG argument, // and splits it with the default delimiter String[] thePaths = USE_ARG.getSplitValues(aArguments); if (thePaths != null) { // (...) } } } |