/**
 * argparser – command line argument parser library
 * 
 * Copyright © 2013  Mattias Andrée (maandree@member.fsf.org)
 * 
 * This library is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
 */


public class Test
{
    public static void main(String... args)
    {
	System.out.println("Parent: " + ArgParser.parentName());
	
	ArgParser parser = new ArgParser("A test for argparser", "test [options] [files]",
					 "Copyright © 2013  Mattias Andrée (maandree@member.fsf.org)\n" +
					 "\n" +
					 "This library is free software: you can redistribute it and/or modify\n" +
					 "it under the terms of the GNU General Public License as published by\n" +
					 "the Free Software Foundation, either version 3 of the License, or\n" +
					 "(at your option) any later version.\n" +
					 "\n" +
					 "This library is distributed in the hope that it will be useful,\n" +
					 "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" +
					 "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n" +
					 "GNU General Public License for more details.\n" +
					 "\n" +
					 "You should have received a copy of the GNU General Public License\n" +
					 "along with this library.  If not, see <http://www.gnu.org/licenses/>.", null, true);
	
	parser.add(new ArgParser.Argumentless(0, "-h", "-?", "--help"), "Prints this help message\n(and exits)");
	parser.add(new ArgParser.Argumentless(0, "--hello"), "Prints the text: hello world");
	parser.add(new ArgParser.Argumentless(0, "++hidden"));
	
	parser.add(new ArgParser.Argumented("LINE", 0, "-l", "--line"), "Prints the choosen line");
	parser.add(new ArgParser.Variadic("LINE", 0, "--l", "--lines"), "Prints the choosen lines");
	
	parser.parse(args);
	parser.supportAlternatives();
	
	parser.help();
    }
    
}


@@ -2339,22 +2339,1017 @@
 %0A%09%0A%09
-parser.help();
+if (parser.opts.get(%22-?%22) != null)%0A%09    parser.help();%0A%09else if ((parser.unrecognisedCount + parser.files.size() == 0) && (parser.arguments.length %3E 0))%0A%09%7B%0A%09    if (parser.opts.get(%22--hello%22) != null)%0A%09    %7B   for (int i = 0, n = parser.opts.get(%22--hello%22).length; i %3C n; i++)%0A%09%09    System.out.println(%22Hello World%22);%0A%09    %7D%0A%09    if (parser.opts.get(%22-l%22) != null)%0A%09    %7B   for (String line : parser.opts.get(%22--line%22))%0A%09%09    System.out.println(line);%0A%09    %7D%0A%09    if (parser.opts.get(%22--lines%22) != null)%0A%09    %7B   for (String line : parser.opts.get(%22--l%22))%0A%09%09    System.out.println(line);%0A%09    %7D%0A%09    if (parser.opts.get(%22++hidden%22) != null)%0A%09    %7B   System.out.println(%22Congratulations, you have found the secret option!%22);%0A%09    %7D%0A%09%7D%0A%09else%0A%09%7B   System.out.println(%22Number of unrecognised options: %22 + parser.unrecognisedCount);%0A%09    System.out.println(%22Entered message: %22 + parser.message);%0A%09    System.out.println(%22Entered files:%22);%0A%09    for (String file : parser.files)%0A%09%09System.out.println(%22%5Ct%22 + file);%0A%09%7D
 %0A   

add argument checking in java test