X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FCommands.java;h=d91081974397bdae50ebaf682450a60adb5df6a8;hb=985d5f40db480896f550db914297cf948a32e963;hp=81641821b1a362d1c7e2e2806e6fb1f3c99c4f74;hpb=471cfb5b0f6bb249e478f0c02d80eeea6a834383;p=jalview.git diff --git a/src/jalview/bin/Commands.java b/src/jalview/bin/Commands.java index 8164182..d910819 100644 --- a/src/jalview/bin/Commands.java +++ b/src/jalview/bin/Commands.java @@ -14,6 +14,7 @@ import java.util.Map; import jalview.analysis.AlignmentUtils; import jalview.api.structures.JalviewStructureDisplayI; +import jalview.bin.Jalview.ExitCode; import jalview.bin.argparser.Arg; import jalview.bin.argparser.ArgParser; import jalview.bin.argparser.ArgParser.Position; @@ -140,7 +141,9 @@ public class Commands } if (argParser.getBoolean(Arg.QUIT)) { - Jalview.getInstance().quit(); + Jalview.getInstance().exit( + "Exiting due to " + Arg.QUIT.argString() + " argument.", + ExitCode.OK); return true; } // carry on with jalview.bin.Jalview @@ -249,21 +252,24 @@ public class Commands Console.debug( "Opening '" + openFile + "' in new alignment frame"); FileLoader fileLoader = new FileLoader(!headless); - boolean xception=false; - try { + boolean xception = false; + try + { af = fileLoader.LoadFileWaitTillLoaded(openFile, protocol, format); } catch (Throwable thr) { - xception=true; - Console.error("Couldn't open '"+openFile+"' as "+format+" "+thr.getLocalizedMessage()+ " (Enable debug for full stack trace)"); - Console.debug("Exception when opening '"+openFile+"'",thr); - } - finally + xception = true; + Console.error("Couldn't open '" + openFile + "' as " + format + + " " + thr.getLocalizedMessage() + + " (Enable debug for full stack trace)"); + Console.debug("Exception when opening '" + openFile + "'", thr); + } finally { - if (af==null && !xception) + if (af == null && !xception) { - Console.info("Ignoring '"+openFile+"' - no alignment data found."); + Console.info("Ignoring '" + openFile + + "' - no alignment data found."); continue; } } @@ -410,7 +416,8 @@ public class Commands { if (headless) { - Jalview.exit("Could not open any files in headless mode", 1); + Jalview.exit("Could not open any files in headless mode", + ExitCode.NO_FILES); } else { @@ -946,7 +953,7 @@ public class Commands Jalview.exit("No valid format specified for " + Arg.OUTPUT.argString() + ". Valid formats are " - + validSB.toString() + ".", 1); + + validSB.toString() + ".", ExitCode.INVALID_FORMAT); // this return really shouldn't happen return false; }