@@ -430,46 +430,50 @@ public Base(String[] args) throws Exception {
430
430
}
431
431
}
432
432
433
- if (action == ACTION .UPLOAD || action == ACTION .VERIFY ) {
434
- // Set verbosity for command line build
435
- Preferences .set ("build.verbose" , "" + doVerboseBuild );
436
- Preferences .set ("upload.verbose" , "" + doVerboseUpload );
437
-
438
- Editor editor = editors .get (0 );
439
-
440
- // Do board selection if requested
441
- processBoardArgument (selectBoard );
442
-
443
- if (action == ACTION .UPLOAD ) {
444
- // Build and upload
445
- if (selectPort != null )
446
- editor .selectSerialPort (selectPort );
447
- editor .exportHandler .run ();
448
- } else {
449
- // Build only
450
- editor .runHandler .run ();
451
- }
452
-
453
- // Error during build or upload
454
- int res = editor .status .mode ;
455
- if (res == EditorStatus .ERR )
456
- System .exit (1 );
433
+ switch (action ) {
434
+ case VERIFY :
435
+ case UPLOAD :
436
+ // Set verbosity for command line build
437
+ Preferences .set ("build.verbose" , "" + doVerboseBuild );
438
+ Preferences .set ("upload.verbose" , "" + doVerboseUpload );
439
+
440
+ Editor editor = editors .get (0 );
441
+
442
+ // Do board selection if requested
443
+ processBoardArgument (selectBoard );
444
+
445
+ if (action == ACTION .UPLOAD ) {
446
+ // Build and upload
447
+ if (selectPort != null )
448
+ editor .selectSerialPort (selectPort );
449
+ editor .exportHandler .run ();
450
+ } else {
451
+ // Build only
452
+ editor .runHandler .run ();
453
+ }
457
454
458
- // No errors exit gracefully
459
- System .exit (0 );
460
- }
455
+ // Error during build or upload
456
+ int res = editor .status .mode ;
457
+ if (res == EditorStatus .ERR )
458
+ System .exit (1 );
461
459
462
- // Check if there were previously opened sketches to be restored
463
- restoreSketches ();
460
+ // No errors exit gracefully
461
+ System .exit (0 );
462
+ break ;
463
+ case GUI :
464
+ // Check if there were previously opened sketches to be restored
465
+ restoreSketches ();
464
466
465
- // Create a new empty window (will be replaced with any files to be opened)
466
- if (editors .isEmpty ()) {
467
- handleNew ();
468
- }
467
+ // Create a new empty window (will be replaced with any files to be opened)
468
+ if (editors .isEmpty ()) {
469
+ handleNew ();
470
+ }
469
471
470
- // Check for updates
471
- if (Preferences .getBoolean ("update.check" )) {
472
- new UpdateCheck (this );
472
+ // Check for updates
473
+ if (Preferences .getBoolean ("update.check" )) {
474
+ new UpdateCheck (this );
475
+ }
476
+ break ;
473
477
}
474
478
}
475
479
0 commit comments