1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-16 11:21:18 +03:00

Command line --get-pref may be used without name of the target pref.

If pref name is missing, all prefs are printed on stdout.
Should fix/mitigate #2982
This commit is contained in:
Federico Fissore
2015-05-29 15:15:08 +02:00
parent a48906e0c2
commit 935becec64
7 changed files with 22 additions and 15 deletions

View File

@ -570,6 +570,12 @@ public class BaseNoGui {
System.exit(0);
}
else if (parser.isGetPrefMode()) {
dumpPrefs(parser);
}
}
protected static void dumpPrefs(CommandlineParser parser) {
if (parser.getGetPref() != null) {
String value = PreferencesData.get(parser.getGetPref(), null);
if (value != null) {
System.out.println(value);
@ -577,6 +583,13 @@ public class BaseNoGui {
} else {
System.exit(4);
}
} else {
System.out.println("#PREFDUMP#");
PreferencesMap prefs = PreferencesData.getMap();
for (Map.Entry<String, String> entry : prefs.entrySet()) {
System.out.println(entry.getKey() + "=" + entry.getValue());
}
System.exit(0);
}
}

View File

@ -58,7 +58,7 @@ public class LegacyTargetBoard implements TargetBoard {
String board = containerPlatform.getId() + "_" + id;
board = board.toUpperCase();
prefs.put("build.board", board);
System.out
System.err
.println(format(_("Board {0}:{1}:{2} doesn''t define a ''build.board'' preference. Auto-set to: {3}"),
containerPlatform.getContainerPackage().getId(),
containerPlatform.getId(), id, board));

View File

@ -51,7 +51,7 @@ public class LegacyTargetPackage implements TargetPackage {
TargetPlatform platform = new LegacyTargetPlatform(arch, subFolder, this);
platforms.put(arch, platform);
} catch (TargetPlatformException e) {
System.out.println(e.getMessage());
System.err.println(e.getMessage());
}
}

View File

@ -73,10 +73,9 @@ public class CommandlineParser {
}
if (a == ACTION.GET_PREF) {
i++;
if (i >= args.length) {
BaseNoGui.showError(null, I18n.format(_("Argument required for {0}"), a.value), 3);
if (i < args.length) {
getPref = args[i];
}
getPref = args[i];
}
if (a == ACTION.INSTALL_BOARD) {
i++;