import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
private Set<Type> argsTypes = new HashSet<>();
+ private boolean outputToStdout = false;
+
public static BootstrapArgs getBootstrapArgs(String[] args)
{
List<String> argList = new ArrayList<>(Arrays.asList(args));
{
if (argFiles.contains(inArgFile))
{
- System.err.println(
+ jalview.bin.Console.errPrintln(
"Looped argfiles detected: '" + inArgFile.getPath() + "'");
return;
}
}
}
- if (ArgParser.argMap.containsKey(argName) && val == null)
+ // after all other args, look for Opt.PREFIX args if still not found
+ if (!ArgParser.argMap.containsKey(argName))
{
- val = "true";
+ for (Arg potentialArg : EnumSet.allOf(Arg.class))
+ {
+ if (potentialArg.hasOption(Opt.PREFIXKEV) && argName != null
+ && argName.startsWith(potentialArg.getName())
+ && val != null)
+ {
+ val = argName.substring(potentialArg.getName().length())
+ + ArgParser.EQUALS + val;
+ argName = argName.substring(0,
+ potentialArg.getName().length());
+ break;
+ }
+ }
}
Arg a = ArgParser.argMap.get(argName);
if (a == null || !a.hasOption(Opt.BOOTSTRAP))
{
- // not a valid bootstrap arg
+ // not a bootstrap arg
+
+ // make a check for an output going to stdout
+ if (a != null && a.hasOption(Opt.OUTPUTFILE)
+ && a.hasOption(Opt.STDOUT))
+ {
+ if (val == null && i + 1 < args.size())
+ {
+ val = args.get(i + 1);
+ }
+ if (val.startsWith("[") && val.indexOf(']') > 0)
+ {
+ val = val.substring(val.indexOf(']') + 1);
+ }
+
+ if (ArgParser.STDOUTFILENAME.equals(val))
+ {
+ this.outputToStdout = true;
+ }
+ }
+
continue;
}
}
else
{
+ if (val == null)
+ {
+ val = "true";
+ }
+
add(a, type, val);
}
}
}
else if (this.contains(Arg.HEADLESS))
{
- // --headless, --noheadless specified => use value
+ // --headless has been specified on the command line => headless
isHeadless = this.getBoolean(Arg.HEADLESS);
}
else if (this.argsHaveOption(Opt.OUTPUTFILE))
}
return isHeadless;
}
+
+ public boolean outputToStdout()
+ {
+ return this.outputToStdout;
+ }
}