Add --pref option

This allows setting preferences through the commandline.
This commit is contained in:
Matthijs Kooijman 2013-10-27 17:03:59 +01:00
parent f502c9b53c
commit 57551b9e79
1 changed files with 16 additions and 0 deletions

View File

@ -364,6 +364,14 @@ public class Base {
showError(null, "Argument required for --curdir", null);
continue;
}
if (args[i].equals("--pref")) {
i++;
if (i < args.length)
processPrefArgument(args[i]);
else
showError(null, "Argument required for --pref", null);
continue;
}
if (args[i].startsWith("--"))
showError(null, I18n.format(_("unknown option: {0}"), args[i]), null);
@ -496,6 +504,14 @@ public class Base {
}
}
protected void processPrefArgument(String arg) {
String[] split = arg.split("=", 2);
if (split.length != 2 || split[0].isEmpty())
showError(null, I18n.format(_("{0}: Invalid argument to --pref, should be of the form \"pref=value\""), arg), null);
Preferences.set(split[0], split[1]);
}
public Map<String, Map<String, Object>> getBoardsViaNetwork() {
return new HashMap<String, Map<String, Object>>(boardsViaNetwork);
}