1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-29 10:24:12 +01:00

Add --noop option

This option causes the IDE to process its commandline arguments and then
quit. This allows setting preferences uses --pref, without having to
also load the GUI or compile a sketch.
This commit is contained in:
Matthijs Kooijman 2014-04-07 12:01:54 +02:00 committed by Cristian Maglie
parent 7cb99ad7b8
commit f745fff50b
2 changed files with 18 additions and 2 deletions

View File

@ -268,7 +268,7 @@ public class Base {
}
protected static enum ACTION { GUI, VERIFY, UPLOAD };
protected static enum ACTION { GUI, VERIFY, UPLOAD, NOOP };
public Base(String[] args) throws Exception {
platform.init(this);
@ -331,6 +331,7 @@ 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);
// Check if any files were passed in on the command line
for (int i = 0; i < args.length; i++) {
@ -405,6 +406,9 @@ public class Base {
if ((action == ACTION.UPLOAD || action == ACTION.VERIFY) && filenames.size() != 1)
showError(null, _("Must specify exactly one sketch file"), 3);
if (action == ACTION.NOOP && filenames.size() != 0)
showError(null, _("Cannot specify any sketch files"), 3);
if ((action != ACTION.UPLOAD && action != ACTION.VERIFY) && (doVerboseBuild || doVerboseUpload))
showError(null, _("--verbose, --verbose-upload and --verbose-build can only be used together with --verify or --upload"), 3);
@ -485,6 +489,10 @@ public class Base {
new UpdateCheck(this);
}
break;
case NOOP:
// Do nothing (intended for only changing preferences)
System.exit(0);
break;
}
}

View File

@ -145,6 +145,10 @@ OPTIONS
*--verify*::
Build the sketch.
*--noop*::
Immediately quit after processing the commandline. This can be
used to just set preferences with *--pref*.
PREFERENCES
-----------
Arduino keeps a list of preferences, as simple name and value pairs.
@ -232,6 +236,10 @@ re-use any previous build results in that directory.
arduino --pref build.path=/path/to/sketch/build --verify /path/to/sketch/sketch.ino
Change the selected board and build path and do nothing else.
arduino --pref build.path=/path/to/sketch/build --board arduino:avr:uno --noop
HISTORY
-------
1.5.2::
@ -259,7 +267,7 @@ HISTORY
Windows, the splash screen is still shown.
1.5.7::
Introduced *--no-save-prefs*.
Introduced *--no-save-prefs* and *--noop*.
{empty}::
*--board* and *--port* options are now saved to the preferences