mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-16 11:21:18 +03: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:
committed by
Cristian Maglie
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 {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user