Revision: 7085
          
http://languagetool.svn.sourceforge.net/languagetool/?rev=7085&view=rev
Author:   dnaber
Date:     2012-05-27 13:40:45 +0000 (Sun, 27 May 2012)
Log Message:
-----------
print error if command line options are wrong

Modified Paths:
--------------
    trunk/JLanguageTool/src/java/org/languagetool/Main.java
    
trunk/JLanguageTool/src/java/org/languagetool/commandline/CommandLineParser.java

Modified: trunk/JLanguageTool/src/java/org/languagetool/Main.java
===================================================================
--- trunk/JLanguageTool/src/java/org/languagetool/Main.java     2012-05-27 
11:45:57 UTC (rev 7084)
+++ trunk/JLanguageTool/src/java/org/languagetool/Main.java     2012-05-27 
13:40:45 UTC (rev 7085)
@@ -438,25 +438,10 @@
     try {
        options = commandLineParser.parseOptions(args);
     } catch (IllegalArgumentException e) {
-      System.out.println("Usage: java -jar LanguageTool.jar [OPTION]... FILE\n"
-                      + " FILE                      plain text file to be 
checked\n"
-                      + " Available options:\n"
-                      + "  -r, --recursive          work recursively on 
directory, not on a single file\n"
-                      + "  -c, --encoding ENC       character set of the input 
text, e.g. utf-8 or latin1\n"
-                      + "  -b                       assume that a single line 
break marks the end of a paragraph\n"
-                      + "  -l, --language LANG      the language code of the 
text, e.g. en for English\n"
-                      + "  -adl, --autoDetect       auto-detect the language 
of the input text\n"
-                      + "  -m, --mothertongue LANG  the language code of your 
first language, used to activate false-friend checking\n"
-                      + "  -d, --disable RULES      a comma-separated list of 
rule ids to be disabled (use no spaces between ids)\n"
-                      + "  -e, --enable RULES       a comma-separated list of 
rule ids to be enabled (use no spaces between ids)\n"
-                      + "  -t, --taggeronly         don't check, but only 
print text analysis (sentences, part-of-speech tags)\n"
-                      + "  -u, --list-unknown       also print a summary of 
words from the input that LanguageTool doesn't know\n"
-                      + "  -b2, --bitext            check bilingual texts with 
a tab-separated input file,\n"
-                      + "                           see 
http://languagetool.wikidot.com/checking-translations-bilingual-texts\n";
-                      + "  --api                    print results as XML\n"
-                      + "  -p, --profile            print performance 
measurements\n"
-                      + "  -v, --verbose            print text analysis 
(sentences, part-of-speech tags) to STDERR\n"
-                      + "  -a, --apply              automatically apply 
suggestions if available, printing result to STDOUT");
+      if (e.getMessage() != null) {
+        System.err.println(e.getMessage());
+      }
+      commandLineParser.printUsage();
       System.exit(1);
     }
 

Modified: 
trunk/JLanguageTool/src/java/org/languagetool/commandline/CommandLineParser.java
===================================================================
--- 
trunk/JLanguageTool/src/java/org/languagetool/commandline/CommandLineParser.java
    2012-05-27 11:45:57 UTC (rev 7084)
+++ 
trunk/JLanguageTool/src/java/org/languagetool/commandline/CommandLineParser.java
    2012-05-27 13:40:45 UTC (rev 7085)
@@ -118,6 +118,28 @@
     return options;
   }
 
+  public void printUsage() {
+    System.out.println("Usage: java -jar LanguageTool.jar [OPTION]... FILE\n"
+            + " FILE                      plain text file to be checked\n"
+            + " Available options:\n"
+            + "  -r, --recursive          work recursively on directory, not 
on a single file\n"
+            + "  -c, --encoding ENC       character set of the input text, 
e.g. utf-8 or latin1\n"
+            + "  -b                       assume that a single line break 
marks the end of a paragraph\n"
+            + "  -l, --language LANG      the language code of the text, e.g. 
en for English\n"
+            + "  -adl, --autoDetect       auto-detect the language of the 
input text\n"
+            + "  -m, --mothertongue LANG  the language code of your first 
language, used to activate false-friend checking\n"
+            + "  -d, --disable RULES      a comma-separated list of rule ids 
to be disabled (use no spaces between ids)\n"
+            + "  -e, --enable RULES       a comma-separated list of rule ids 
to be enabled (use no spaces between ids)\n"
+            + "  -t, --taggeronly         don't check, but only print text 
analysis (sentences, part-of-speech tags)\n"
+            + "  -u, --list-unknown       also print a summary of words from 
the input that LanguageTool doesn't know\n"
+            + "  -b2, --bitext            check bilingual texts with a 
tab-separated input file,\n"
+            + "                           see 
http://languagetool.wikidot.com/checking-translations-bilingual-texts\n";
+            + "  --api                    print results as XML\n"
+            + "  -p, --profile            print performance measurements\n"
+            + "  -v, --verbose            print text analysis (sentences, 
part-of-speech tags) to STDERR\n"
+            + "  -a, --apply              automatically apply suggestions if 
available, printing result to STDOUT");
+  }
+
   private void checkArguments(String option, int argParsingPos, String[] args) 
{
     if (argParsingPos + 1 >= args.length) {
       throw new IllegalArgumentException("Missing argument to " + option + " 
command line option.");

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Languagetool-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/languagetool-cvs

Reply via email to