mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-18 12:54:25 +01:00
Add --pref option
This allows setting preferences through the commandline.
This commit is contained in:
parent
f502c9b53c
commit
57551b9e79
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user