import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
import jalview.bin.Console;
if (argMap.containsKey(argName))
{
Console.warn("Trying to add argument name multiple times: '"
- + argName + "'"); // RESTORE THIS WHEN MERGED
+ + argName + "'"); // RESTORE THIS WHEN
+ // MERGED
if (argMap.get(argName) != a)
{
Console.error(
if (openEachInitialFilenames && !arg.startsWith(DOUBLEDASH)
&& !arg.startsWith("-") && new File(arg).exists())
{
- arg = DOUBLEDASH + Arg.OPENNEW.getName();
+ arg = Arg.OPENNEW.argString();
}
else
{
}
if (a.hasOption(Opt.PRIVATE) && !allowPrivate)
{
- Console.error("Argument '" + DOUBLEDASH + argName
- + "' is private. Ignoring.");
+ Console.error(
+ "Argument '" + a.argString() + "' is private. Ignoring.");
continue;
}
if (!a.hasOption(Opt.BOOLEAN) && negated)
if (!a.hasOption(Opt.STRING) && equalPos > -1)
{
// set --argname=value when arg does not accept values
- Console.error("Argument '" + DOUBLEDASH + argName
+ Console.error("Argument '" + a.argString()
+ "' does not expect a value (given as '" + arg
+ "'). Ignoring.");
continue;
if (!a.hasOption(Opt.LINKED) && linkedId != null)
{
// set --argname[linkedId] when arg does not use linkedIds
- Console.error("Argument '" + DOUBLEDASH + argName
+ Console.error("Argument '" + a.argString()
+ "' does not expect a linked id (given as '" + arg
+ "'). Ignoring.");
continue;
// not dealing with both NODUPLICATEVALUES and GLOB
if (a.hasOption(Opt.NODUPLICATEVALUES) && avm.hasValue(a, val))
{
- Console.error("Argument '" + DOUBLEDASH + argName
+ Console.error("Argument '" + a.argString()
+ "' cannot contain a duplicate value ('" + val
+ "'). Ignoring this and subsequent occurrences.");
continue;
String id = idsv.get(ArgValues.ID);
if (id != null && avm.hasId(a, id))
{
- Console.error("Argument '" + DOUBLEDASH + argName
+ Console.error("Argument '" + a.argString()
+ "' has a duplicate id ('" + id + "'). Ignoring.");
continue;
}
/*
* A helper method to take a list of String args where we're expecting
* {"--previousargs", "--arg", "file1", "file2", "file3", "--otheroptionsornot"}
- * and the index of the globbed arg, here 1. It returns a
- * List<String> {"file1", "file2", "file3"}
- * *and remove these from the original list object* so that processing
- * can continue from where it has left off, e.g. args has become
- * {"--previousargs", "--arg", "--otheroptionsornot"}
- * so the next increment carries on from the next --arg if available.
+ * and the index of the globbed arg, here 1. It returns a List<String> {"file1",
+ * "file2", "file3"} *and remove these from the original list object* so that
+ * processing can continue from where it has left off, e.g. args has become
+ * {"--previousargs", "--arg", "--otheroptionsornot"} so the next increment
+ * carries on from the next --arg if available.
*/
protected static List<String> getShellGlobbedFilenameValues(Arg a,
List<String> args, int i)
{
if (!argFile.exists())
{
- String message = DOUBLEDASH
- + Arg.ARGFILE.name().toLowerCase(Locale.ROOT) + EQUALS
- + "\"" + argFile.getPath() + "\": File does not exist.";
+ String message = Arg.ARGFILE.argString() + EQUALS + "\""
+ + argFile.getPath() + "\": File does not exist.";
Jalview.exit(message, 2);
}
try
{
- String setargfile = new StringBuilder(ArgParser.DOUBLEDASH)
- .append(Arg.SETARGFILE.getName()).append(EQUALS)
- .append(argFile.getCanonicalPath()).toString();
+ String setargfile = new StringBuilder(Arg.SETARGFILE.argString())
+ .append(EQUALS).append(argFile.getCanonicalPath())
+ .toString();
argsList.add(setargfile);
argsList.addAll(Files.readAllLines(Paths.get(argFile.getPath())));
- argsList.add(new StringBuilder(ArgParser.DOUBLEDASH)
- .append(Arg.UNSETARGFILE.getName()).toString());
+ argsList.add(Arg.UNSETARGFILE.argString());
} catch (IOException e)
{
- String message = DOUBLEDASH
- + Arg.ARGFILE.name().toLowerCase(Locale.ROOT) + "=\""
- + argFile.getPath() + "\": File could not be read.";
+ String message = Arg.ARGFILE.argString() + "=\"" + argFile.getPath()
+ + "\": File could not be read.";
Jalview.exit(message, 3);
}
}