X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fbin%2FJalview.java;h=b8aa92821b2c70adf990dcf4f153513b93f88952;hb=refs%2Fheads%2Fcherrypicks%2FJAL-3660_JAL-3561_JAL-3662_cli_outputformat;hp=fea99fb910c5667e92e9ee71e7891af07b6124d9;hpb=d34c8baf951c6aa41f95413c1d6b00d5d1f35954;p=jalview.git diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java index fea99fb..b8aa928 100755 --- a/src/jalview/bin/Jalview.java +++ b/src/jalview/bin/Jalview.java @@ -73,7 +73,6 @@ import jalview.schemes.ColourSchemeProperty; import jalview.util.MessageManager; import jalview.util.Platform; import jalview.ws.jws2.Jws2Discoverer; -//import netscape.javascript.JSObject; /** * Main class for Jalview Application
@@ -1038,28 +1037,43 @@ public class Jalview implements ApplicationSingletonI "Creating image map: " + imageFile.getAbsolutePath()); continue; default: - format = FileFormats.getInstance().forName(outputFormat); - if (format == null) - { - System.out.println("Invalid file format: " + outputFormat); - break; - } - fname = new File(aparser.nextValue()).getAbsolutePath(); - af.saveAlignment(fname, format); - if (!af.isSaveAlignmentSuccessful()) - { - System.out.println("Error writing file " + fname + " in " + format - + " format!!"); - break; - } - continue; + // fall through - try to parse as an alignment data export format + FileFormatI outFormat=null; + try { + outFormat = FileFormats.getInstance().forName(outputFormat); + } catch (Exception formatP) { + } + if (outFormat==null) { + System.out.println("Couldn't parse "+outputFormat+" as a valid Jalview format string."); + continue; + } + if (!outFormat.isWritable()) + { + System.out.println( + "This version of Jalview does not support alignment export as " + + outputFormat); + continue; + } + // record file as it was passed to Jalview so it is recognisable to the CLI caller + String file; + fname = new File(file=aparser.nextValue()).getAbsolutePath(); + // JBPNote - yuck - really wish we did have a bean returned from this which gave success/fail like before ! + af.saveAlignment(fname, outFormat); + if (!af.isSaveAlignmentSuccessful()) + { + System.out.println("Written alignment in " + outputFormat + + " format to " + file); + continue; + } else { + System.out.println("Error writing file " + file + " in " + + outputFormat + " format!!"); + } } - System.out.println("Unknown arg: " + outputFormat); - break; } + // ??? Should report - 'ignoring' extra args here... while (aparser.getSize() > 0) { - System.out.println("Unknown arg: " + aparser.nextValue()); + System.out.println("Ignoring extra argument: " + aparser.nextValue()); } }