mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-19 13:54:23 +01:00
Removed --no-op from CLI. Preferences now not-saved by default.
See https://github.com/arduino/Arduino/pull/2000 for details. Close #2000
This commit is contained in:
parent
e3dc5e75e3
commit
ec1310e1bd
@ -360,6 +360,7 @@ public class Base {
|
||||
ACTION action = ACTION.GUI;
|
||||
boolean doVerboseBuild = false;
|
||||
boolean doVerboseUpload = false;
|
||||
boolean forceSavePrefs = false;
|
||||
String getPref = null;
|
||||
List<String> filenames = new LinkedList<String>();
|
||||
|
||||
@ -367,14 +368,13 @@ public class Base {
|
||||
final Map<String, ACTION> actions = new HashMap<String, ACTION>();
|
||||
actions.put("--verify", ACTION.VERIFY);
|
||||
actions.put("--upload", ACTION.UPLOAD);
|
||||
actions.put("--noop", ACTION.NOOP);
|
||||
actions.put("--get-pref", ACTION.GET_PREF);
|
||||
|
||||
// Check if any files were passed in on the command line
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
ACTION a = actions.get(args[i]);
|
||||
if (a != null) {
|
||||
if (action != ACTION.GUI) {
|
||||
if (action != ACTION.GUI && action != ACTION.NOOP) {
|
||||
String[] valid = actions.keySet().toArray(new String[0]);
|
||||
String mess = I18n.format(_("Can only pass one of: {0}"), PApplet.join(valid, ", "));
|
||||
showError(null, mess, 3);
|
||||
@ -391,14 +391,20 @@ public class Base {
|
||||
if (args[i].equals("--verbose") || args[i].equals("-v")) {
|
||||
doVerboseBuild = true;
|
||||
doVerboseUpload = true;
|
||||
if (action == ACTION.GUI)
|
||||
action = ACTION.NOOP;
|
||||
continue;
|
||||
}
|
||||
if (args[i].equals("--verbose-build")) {
|
||||
doVerboseBuild = true;
|
||||
if (action == ACTION.GUI)
|
||||
action = ACTION.NOOP;
|
||||
continue;
|
||||
}
|
||||
if (args[i].equals("--verbose-upload")) {
|
||||
doVerboseUpload = true;
|
||||
if (action == ACTION.GUI)
|
||||
action = ACTION.NOOP;
|
||||
continue;
|
||||
}
|
||||
if (args[i].equals("--board")) {
|
||||
@ -406,6 +412,8 @@ public class Base {
|
||||
if (i >= args.length)
|
||||
showError(null, _("Argument required for --board"), 3);
|
||||
processBoardArgument(args[i]);
|
||||
if (action == ACTION.GUI)
|
||||
action = ACTION.NOOP;
|
||||
continue;
|
||||
}
|
||||
if (args[i].equals("--port")) {
|
||||
@ -413,6 +421,8 @@ public class Base {
|
||||
if (i >= args.length)
|
||||
showError(null, _("Argument required for --port"), 3);
|
||||
Base.selectSerialPort(args[i]);
|
||||
if (action == ACTION.GUI)
|
||||
action = ACTION.NOOP;
|
||||
continue;
|
||||
}
|
||||
if (args[i].equals("--curdir")) {
|
||||
@ -427,10 +437,12 @@ public class Base {
|
||||
if (i >= args.length)
|
||||
showError(null, _("Argument required for --pref"), 3);
|
||||
processPrefArgument(args[i]);
|
||||
if (action == ACTION.GUI)
|
||||
action = ACTION.NOOP;
|
||||
continue;
|
||||
}
|
||||
if (args[i].equals("--no-save-prefs")) {
|
||||
Preferences.setDoSave(false);
|
||||
if (args[i].equals("--save-prefs")) {
|
||||
forceSavePrefs = true;
|
||||
continue;
|
||||
}
|
||||
if (args[i].equals("--preferences-file")) {
|
||||
@ -472,6 +484,8 @@ public class Base {
|
||||
}
|
||||
|
||||
boolean showEditor = (action == ACTION.GUI);
|
||||
if (!forceSavePrefs)
|
||||
Preferences.setDoSave(showEditor);
|
||||
if (handleOpen(file, nextEditorLocation(), showEditor) == null) {
|
||||
String mess = I18n.format(_("Failed to open sketch: \"{0}\""), path);
|
||||
// Open failure is fatal in upload/verify mode
|
||||
|
@ -36,7 +36,7 @@ compiling and uploading sketches (programs) for Arduino
|
||||
Normally, running the arduino command starts the IDE, optionally loading
|
||||
any .ino files specified on the commandline.
|
||||
|
||||
Alternatively, if *--verify* or *--upload* is given, no graphical
|
||||
Alternatively, if any of the following command line options is given, no graphical
|
||||
interface will be shown and instead a one-off verify (compile) or upload
|
||||
will be done. A single .ino file should be given. If the sketch contains
|
||||
multiple .ino files, any one can be specified on the commandline, but
|
||||
@ -75,9 +75,6 @@ OPTIONS
|
||||
{empty}::
|
||||
If this option is not passed, the value from the current
|
||||
preferences is used (e.g., the last board selected in the IDE).
|
||||
If this option is given, the value passed is written to the
|
||||
preferences file and rememberd for subsequent runs (except when
|
||||
*--no-save-prefs* is passed).
|
||||
|
||||
*--port* __portname__::
|
||||
Select the serial port to perform upload of the sketch.
|
||||
@ -88,13 +85,10 @@ OPTIONS
|
||||
{empty}::
|
||||
If this option is not passed, the value from the current
|
||||
preferences is used (e.g., the last port selected in the IDE).
|
||||
If this option is given, the value passed is written to the
|
||||
preferences file and rememberd for subsequent runs (except when
|
||||
*--no-save-prefs* is passed).
|
||||
|
||||
*--verbose-build*::
|
||||
Enable verbose mode during build. If this option is not given,
|
||||
verbose mode during build is disabled regardless of the current
|
||||
verbose mode during build is *disabled* regardless of the current
|
||||
preferences.
|
||||
|
||||
{empty}::
|
||||
@ -103,7 +97,7 @@ OPTIONS
|
||||
|
||||
*--verbose-upload*::
|
||||
Enable verbose mode during upload. If this option is not given,
|
||||
verbose mode during upload is disabled regardless of the current
|
||||
verbose mode during upload is *disabled* regardless of the current
|
||||
preferences.
|
||||
|
||||
{empty}::
|
||||
@ -131,13 +125,10 @@ OPTIONS
|
||||
validated: Invalid names will be set but never used, invalid
|
||||
values might lead to an error later on.
|
||||
|
||||
{empty}::
|
||||
If this option is given, the value passed is written to the
|
||||
preferences file and rememberd for subsequent runs (except when
|
||||
*--no-save-prefs* is passed).
|
||||
|
||||
*--no-save-prefs*::
|
||||
Do not save any (changed) preferences to *preferences.txt*.
|
||||
*--save-prefs*::
|
||||
Save any (changed) preferences to *preferences.txt*. In particular
|
||||
*--board*, *--port*, *--pref*, *--verbose*, *--verbose-build* and
|
||||
*--verbose-upload* may alter the current preferences.
|
||||
|
||||
*--upload*::
|
||||
Build and upload the sketch.
|
||||
@ -145,10 +136,6 @@ OPTIONS
|
||||
*--verify*::
|
||||
Build the sketch.
|
||||
|
||||
*--noop*::
|
||||
Immediately quit after processing the commandline. This can be
|
||||
used to just set preferences with *--pref*.
|
||||
|
||||
*--get-pref __preference__*::
|
||||
Prints the value of the given preference to the standard output
|
||||
stream. When the value does not exist, nothing is printed and
|
||||
@ -244,7 +231,7 @@ re-use any previous build results in that directory.
|
||||
|
||||
Change the selected board and build path and do nothing else.
|
||||
|
||||
arduino --pref build.path=/path/to/sketch/build --board arduino:avr:uno --noop
|
||||
arduino --pref build.path=/path/to/sketch/build --board arduino:avr:uno --save-prefs
|
||||
|
||||
HISTORY
|
||||
-------
|
||||
@ -272,13 +259,12 @@ HISTORY
|
||||
longer shown. Error messages still use a graphical popup and on
|
||||
Windows, the splash screen is still shown.
|
||||
|
||||
1.5.7::
|
||||
Introduced *--no-save-prefs* and *--noop*.
|
||||
1.5.8::
|
||||
Introduced *--save-prefs*.
|
||||
|
||||
{empty}::
|
||||
*--board* and *--port* options are now saved to the preferences
|
||||
file, just like *--pref*. The *--verbose* options still only
|
||||
apply to the current run.
|
||||
*--pref* options are now not saved to the preferences file, just
|
||||
like *--board* and *--port*, unless *--save-prefs* is specified.
|
||||
|
||||
{empty}::
|
||||
A path passed to *--preferences-file*, or set in the
|
||||
|
Loading…
x
Reference in New Issue
Block a user