Skip to content

Commit f745fff

Browse files
matthijskooijmancmaglie
authored andcommitted
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.
1 parent 7cb99ad commit f745fff

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

app/src/processing/app/Base.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ static protected void initRequirements() {
268268
}
269269

270270

271-
protected static enum ACTION { GUI, VERIFY, UPLOAD };
271+
protected static enum ACTION { GUI, VERIFY, UPLOAD, NOOP };
272272
public Base(String[] args) throws Exception {
273273
platform.init(this);
274274

@@ -331,6 +331,7 @@ public Base(String[] args) throws Exception {
331331
final Map<String, ACTION> actions = new HashMap<String, ACTION>();
332332
actions.put("--verify", ACTION.VERIFY);
333333
actions.put("--upload", ACTION.UPLOAD);
334+
actions.put("--noop", ACTION.NOOP);
334335

335336
// Check if any files were passed in on the command line
336337
for (int i = 0; i < args.length; i++) {
@@ -405,6 +406,9 @@ public Base(String[] args) throws Exception {
405406
if ((action == ACTION.UPLOAD || action == ACTION.VERIFY) && filenames.size() != 1)
406407
showError(null, _("Must specify exactly one sketch file"), 3);
407408

409+
if (action == ACTION.NOOP && filenames.size() != 0)
410+
showError(null, _("Cannot specify any sketch files"), 3);
411+
408412
if ((action != ACTION.UPLOAD && action != ACTION.VERIFY) && (doVerboseBuild || doVerboseUpload))
409413
showError(null, _("--verbose, --verbose-upload and --verbose-build can only be used together with --verify or --upload"), 3);
410414

@@ -485,6 +489,10 @@ public Base(String[] args) throws Exception {
485489
new UpdateCheck(this);
486490
}
487491
break;
492+
case NOOP:
493+
// Do nothing (intended for only changing preferences)
494+
System.exit(0);
495+
break;
488496
}
489497
}
490498

build/shared/manpage.adoc

+9-1
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ OPTIONS
145145
*--verify*::
146146
Build the sketch.
147147

148+
*--noop*::
149+
Immediately quit after processing the commandline. This can be
150+
used to just set preferences with *--pref*.
151+
148152
PREFERENCES
149153
-----------
150154
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.
232236

233237
arduino --pref build.path=/path/to/sketch/build --verify /path/to/sketch/sketch.ino
234238

239+
Change the selected board and build path and do nothing else.
240+
241+
arduino --pref build.path=/path/to/sketch/build --board arduino:avr:uno --noop
242+
235243
HISTORY
236244
-------
237245
1.5.2::
@@ -259,7 +267,7 @@ HISTORY
259267
Windows, the splash screen is still shown.
260268
261269
1.5.7::
262-
Introduced *--no-save-prefs*.
270+
Introduced *--no-save-prefs* and *--noop*.
263271
264272
{empty}::
265273
*--board* and *--port* options are now saved to the preferences

0 commit comments

Comments
 (0)