From: Ben Soares Date: Wed, 9 Aug 2023 16:21:34 +0000 (+0100) Subject: JAL-629 Default to FASTA if no format given for output to STDOUT X-Git-Tag: Release_2_11_4_0~198^2~7 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=b58f8f5b699a2cbf04f3d5cda87de31b81811e10;p=jalview.git JAL-629 Default to FASTA if no format given for output to STDOUT --- diff --git a/src/jalview/bin/Commands.java b/src/jalview/bin/Commands.java index a3d87f7..c08bcc5 100644 --- a/src/jalview/bin/Commands.java +++ b/src/jalview/bin/Commands.java @@ -913,23 +913,30 @@ public class Commands } if (ff == null) { - StringBuilder validSB = new StringBuilder(); - for (String f : validFormats) - { - if (validSB.length() > 0) - validSB.append(", "); - validSB.append(f); - FileFormatI tff = ffs.forName(f); - validSB.append(" ("); - validSB.append(tff.getExtensions()); - validSB.append(")"); + if (stdout) + { + ff = FileFormat.Fasta; } + else + { + StringBuilder validSB = new StringBuilder(); + for (String f : validFormats) + { + if (validSB.length() > 0) + validSB.append(", "); + validSB.append(f); + FileFormatI tff = ffs.forName(f); + validSB.append(" ("); + validSB.append(tff.getExtensions()); + validSB.append(")"); + } - Jalview.exit("No valid format specified for " - + Arg.OUTPUT.argString() + ". Valid formats are " - + validSB.toString() + ".", 1); - // this return really shouldn't happen - return false; + Jalview.exit("No valid format specified for " + + Arg.OUTPUT.argString() + ". Valid formats are " + + validSB.toString() + ".", 1); + // this return really shouldn't happen + return false; + } } String savedBackupsPreference = Cache