// Initialising arguments (BOOTSTRAP)
HELP(Type.HELP, "h", "Display this help statement", Opt.UNARY,
- Opt.BOOTSTRAP, Opt.HASTYPE),
+ Opt.BOOTSTRAP, Opt.HASTYPE, Opt.MULTI),
/*
* Other --help-type Args will be added by the static block.
*/
OUTPUT("Arguments used to save data from a processed alignment"),
IMAGE("Arguments used to export an image of an alignment"),
FLOW("Arguments that control processing of the other arguments"),
+ HELP("Arguments to provide help text"), // --help
ALL("All arguments"), // mostly just a place-holder for --help-all
- HELP("Arguments to provide help text");
+ NONE("No specific arguments"), // mostly a place-holder for --help
+ INVALID("This type of argument doesn't exist");
private String description;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
String val = null;
Type type = null;
// remove "--"
- arg = arg.substring(ArgParser.DOUBLEDASH.length());
+ argName = arg.substring(ArgParser.DOUBLEDASH.length());
// look for equals e.g. --arg=value
- int equalPos = arg.indexOf(ArgParser.EQUALS);
- if (equalPos > -1
- && ArgParser.argMap.containsKey(arg.substring(0, equalPos)))
+ int equalPos = argName.indexOf(ArgParser.EQUALS);
+ if (equalPos > -1)
{
- argName = arg.substring(0, equalPos);
- val = arg.substring(equalPos + 1);
+ val = argName.substring(equalPos + 1);
+ argName = argName.substring(0, equalPos);
}
+
// check for boolean prepended by "no"
- else if (arg.startsWith(ArgParser.NEGATESTRING)
+ if (argName.startsWith(ArgParser.NEGATESTRING)
&& ArgParser.argMap.containsKey(
- arg.substring(ArgParser.NEGATESTRING.length())))
+ argName.substring(ArgParser.NEGATESTRING.length())))
{
- argName = arg.substring(ArgParser.NEGATESTRING.length());
val = "false";
+ argName = argName.substring(ArgParser.NEGATESTRING.length());
}
- else if (ArgParser.argMap.containsKey(arg))
- {
- argName = arg;
- val = "true";
- }
- else
+
+ // look for type modification e.g. --help-opening
+ int dashPos = argName.indexOf(ArgParser.SINGLEDASH);
+ if (dashPos > -1)
{
- // look for type modification e.g. --help-opening
- int dashPos = arg.indexOf(ArgParser.SINGLEDASH);
- if (dashPos > -1)
+ String potentialArgName = argName.substring(0, dashPos);
+ Arg potentialArg = ArgParser.argMap.get(potentialArgName);
+ if (potentialArg != null && potentialArg.hasOption(Opt.HASTYPE))
{
- String potentialArgName = arg.substring(0, dashPos);
- Arg potentialArg = ArgParser.argMap.get(potentialArgName);
- if (potentialArg != null && potentialArg.hasOption(Opt.HASTYPE))
+ String typeName = argName.substring(dashPos + 1);
+ try
{
- argName = arg.substring(0, dashPos);
- String typeName = arg.substring(dashPos + 1);
- type = Type.valueOf(typeName);
+ type = Type.valueOf(typeName.toUpperCase(Locale.ROOT));
+ } catch (IllegalArgumentException e)
+ {
+ type = Type.INVALID;
}
+ argName = argName.substring(0, dashPos);
}
}
+ if (ArgParser.argMap.containsKey(argName) && val == null)
+ {
+ val = "true";
+ }
+
Arg a = ArgParser.argMap.get(argName);
if (a == null || !a.hasOption(Opt.BOOTSTRAP))