From b58f8f5b699a2cbf04f3d5cda87de31b81811e10 Mon Sep 17 00:00:00 2001 From: Ben Soares Date: Wed, 9 Aug 2023 17:21:34 +0100 Subject: [PATCH] JAL-629 Default to FASTA if no format given for output to STDOUT --- src/jalview/bin/Commands.java | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) 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 -- 1.7.10.2