diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 885322e5e..184eedc94 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -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> getBoardsViaNetwork() { return new HashMap>(boardsViaNetwork); }