Wrote a usage message for the CommandLineRunner.

git-svn-id: https://zxing.googlecode.com/svn/trunk@962 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
dswitkin 2009-05-28 18:59:11 +00:00
parent c07fad6410
commit 0fe2f0365f

View file

@ -55,6 +55,10 @@ public final class CommandLineRunner {
}
public static void main(String[] args) throws Exception {
if (args == null || args.length == 0) {
printUsage();
return;
}
Hashtable<DecodeHintType, Object> hints = null;
boolean dumpResults = false;
boolean dumpBlackPoint = false;
@ -66,8 +70,9 @@ public final class CommandLineRunner {
dumpResults = true;
} else if ("--dump_black_point".equals(arg)) {
dumpBlackPoint = true;
} else if (arg.startsWith("--")) {
} else if (arg.startsWith("-")) {
System.out.println("Unknown command line option " + arg);
printUsage();
return;
}
}
@ -78,6 +83,14 @@ public final class CommandLineRunner {
}
}
private static void printUsage() {
System.out.println("Decode barcode images using the ZXing library\n");
System.out.println("usage: CommandLineRunner { file | dir | url } [ options ]");
System.out.println(" --try_harder: Use the TRY_HARDER hint, default is normal (mobile) mode");
System.out.println(" --dump_results: Write the decoded contents to input.txt");
System.out.println(" --dump_black_point: Compare black point algorithms as input.mono.png");
}
private static void decodeOneArgument(String argument, Hashtable<DecodeHintType, Object> hints,
boolean dumpResults, boolean dumpBlackPoint) throws IOException,
URISyntaxException {