mirror of
https://github.com/arduino/Arduino.git
synced 2024-12-01 12:24:14 +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:
parent
7cb99ad7b8
commit
f745fff50b
@ -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 {
|
public Base(String[] args) throws Exception {
|
||||||
platform.init(this);
|
platform.init(this);
|
||||||
|
|
||||||
@ -331,6 +331,7 @@ public class Base {
|
|||||||
final Map<String, ACTION> actions = new HashMap<String, ACTION>();
|
final Map<String, ACTION> actions = new HashMap<String, ACTION>();
|
||||||
actions.put("--verify", ACTION.VERIFY);
|
actions.put("--verify", ACTION.VERIFY);
|
||||||
actions.put("--upload", ACTION.UPLOAD);
|
actions.put("--upload", ACTION.UPLOAD);
|
||||||
|
actions.put("--noop", ACTION.NOOP);
|
||||||
|
|
||||||
// Check if any files were passed in on the command line
|
// Check if any files were passed in on the command line
|
||||||
for (int i = 0; i < args.length; i++) {
|
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)
|
if ((action == ACTION.UPLOAD || action == ACTION.VERIFY) && filenames.size() != 1)
|
||||||
showError(null, _("Must specify exactly one sketch file"), 3);
|
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))
|
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);
|
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);
|
new UpdateCheck(this);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case NOOP:
|
||||||
|
// Do nothing (intended for only changing preferences)
|
||||||
|
System.exit(0);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,6 +145,10 @@ OPTIONS
|
|||||||
*--verify*::
|
*--verify*::
|
||||||
Build the sketch.
|
Build the sketch.
|
||||||
|
|
||||||
|
*--noop*::
|
||||||
|
Immediately quit after processing the commandline. This can be
|
||||||
|
used to just set preferences with *--pref*.
|
||||||
|
|
||||||
PREFERENCES
|
PREFERENCES
|
||||||
-----------
|
-----------
|
||||||
Arduino keeps a list of preferences, as simple name and value pairs.
|
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
|
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
|
HISTORY
|
||||||
-------
|
-------
|
||||||
1.5.2::
|
1.5.2::
|
||||||
@ -259,7 +267,7 @@ HISTORY
|
|||||||
Windows, the splash screen is still shown.
|
Windows, the splash screen is still shown.
|
||||||
|
|
||||||
1.5.7::
|
1.5.7::
|
||||||
Introduced *--no-save-prefs*.
|
Introduced *--no-save-prefs* and *--noop*.
|
||||||
|
|
||||||
{empty}::
|
{empty}::
|
||||||
*--board* and *--port* options are now saved to the preferences
|
*--board* and *--port* options are now saved to the preferences
|
||||||
|
Loading…
Reference in New Issue
Block a user