From a569f5a9ddcd54a98f904e64d2344d17c94163a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torsten=20St=C3=B6ter?= Date: Thu, 27 Jun 2024 14:18:01 +0200 Subject: [PATCH] Use `-` instead of `--` to read files from stdin. Adhere to GNU utils convention of using `-` for reading from stdin. Also expand and adapt usage information. --- .../src/loci/formats/tools/ImageInfo.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/bio-formats-tools/src/loci/formats/tools/ImageInfo.java b/components/bio-formats-tools/src/loci/formats/tools/ImageInfo.java index 16ab96d47f3..f8a90ae2141 100644 --- a/components/bio-formats-tools/src/loci/formats/tools/ImageInfo.java +++ b/components/bio-formats-tools/src/loci/formats/tools/ImageInfo.java @@ -314,7 +314,8 @@ public void printUsage() { "", " -version: print the library version and exit", " file: the image file to read", - " reads file names line-wise from stdin if -- is passed", + " if - is passed, process multiple files", + " with file names read line-wise from stdin", " -nopix: read metadata only, not pixels", " -nocore: do not output core metadata", " -nometa: do not parse format-specific metadata table", @@ -1132,7 +1133,7 @@ public static void main(String[] args) throws Exception { DebugTools.enableLogging("INFO"); List argsList = Arrays.asList(args); - int idx = argsList.indexOf("--"); + int idx = argsList.indexOf("-"); if (idx >= 0) { Scanner scanner = new Scanner(System.in); @@ -1140,6 +1141,7 @@ public static void main(String[] args) throws Exception { while (scanner.hasNext()) { newArgs[idx] = scanner.nextLine(); + System.out.println("====% " + newArgs[idx]); if (!new ImageInfo().testRead(newArgs)) System.exit(1); } scanner.close(); @@ -1150,3 +1152,4 @@ public static void main(String[] args) throws Exception { } } +