mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-19 09:42:11 +03:00
Extended command line flags
This commit is contained in:
@ -278,6 +278,8 @@ public class Base {
|
|||||||
|
|
||||||
boolean opened = false;
|
boolean opened = false;
|
||||||
boolean doUpload = false;
|
boolean doUpload = false;
|
||||||
|
boolean doVerify = false;
|
||||||
|
boolean doVerbose = false;
|
||||||
String selectBoard = null;
|
String selectBoard = null;
|
||||||
String selectPort = null;
|
String selectPort = null;
|
||||||
// Check if any files were passed in on the command line
|
// Check if any files were passed in on the command line
|
||||||
@ -286,6 +288,14 @@ public class Base {
|
|||||||
doUpload = true;
|
doUpload = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (args[i].equals("--verify")) {
|
||||||
|
doVerify = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (args[i].equals("--verbose") || args[i].equals("-v")) {
|
||||||
|
doVerbose = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (args[i].equals("--board")) {
|
if (args[i].equals("--board")) {
|
||||||
i++;
|
i++;
|
||||||
if (i < args.length)
|
if (i < args.length)
|
||||||
@ -316,16 +326,37 @@ public class Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (doUpload) {
|
if (doUpload || doVerify) {
|
||||||
if (!opened)
|
if (!opened) {
|
||||||
throw new Exception(_("Can't open source sketch!"));
|
System.out.println(_("Can't open source sketch!"));
|
||||||
|
System.exit(2);
|
||||||
|
}
|
||||||
Thread.sleep(2000);
|
Thread.sleep(2000);
|
||||||
|
// Set verbosity for command line build
|
||||||
|
Preferences.set("build.verbose", "" + doVerbose);
|
||||||
|
Preferences.set("upload.verbose", "" + doVerbose);
|
||||||
|
|
||||||
|
// Do board selection if requested
|
||||||
Editor editor = editors.get(0);
|
Editor editor = editors.get(0);
|
||||||
if (selectPort != null)
|
|
||||||
editor.selectSerialPort(selectPort);
|
|
||||||
if (selectBoard != null)
|
if (selectBoard != null)
|
||||||
selectBoard(selectBoard, editor);
|
selectBoard(selectBoard, editor);
|
||||||
editor.exportHandler.run();
|
|
||||||
|
if (doUpload) {
|
||||||
|
// Build and upload
|
||||||
|
if (selectPort != null)
|
||||||
|
editor.selectSerialPort(selectPort);
|
||||||
|
editor.exportHandler.run();
|
||||||
|
} else {
|
||||||
|
// Build only
|
||||||
|
editor.runHandler.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Error during build or upload
|
||||||
|
int res = editor.status.mode;
|
||||||
|
if (res == EditorStatus.ERR)
|
||||||
|
System.exit(1);
|
||||||
|
|
||||||
|
// No errors exit gracefully
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user