package comp3500.abn;

import org.apache.commons.cli.Options;

public class CommonsTest {

	public void parse(String args[]) {
		Options options = new Options();
		
		options.addOption("help", "Display usage information");
		options.addOption("list-emitters", "List emitters available to format output with");
	}
	
	public static void main(String args[]) {
		
	}
}

@@ -50,45 +50,374 @@
 cli.
-Options;%0A%0Apublic class CommonsTest %7B%0A
+CommandLine;%0Aimport org.apache.commons.cli.CommandLineParser;%0Aimport org.apache.commons.cli.DefaultParser;%0Aimport org.apache.commons.cli.Options;%0Aimport org.apache.commons.cli.ParseException;%0A%0Apublic class CommonsTest %7B%0A%0A%09%0A%09public static final String HELP_TEXT = %22Usage info...%22;%0A%09%0A%09private boolean helpMode = false;%0A%09private boolean help_listEmitters = false;%0A%09%0A%09%0A%09
 %0A%09pu
@@ -574,10 +574,9 @@
 list
--e
+E
 mitt
@@ -636,56 +636,576 @@
 );%0A%09
-%7D%0A%09%0A%09public static void main(String args%5B%5D) %7B%0A%09%09
+%09%0A%09%09CommandLineParser parser = new DefaultParser();%0A%09%09%0A%09%09CommandLine cmd = null;%0A%09%09try %7B%0A%09%09%09cmd = parser.parse(options, args);%0A%09%09%7D catch (ParseException e) %7B%0A%09%09%09System.err.println(%22Parse exception: %22 + e.getMessage());%0A%09%09%7D%0A%09%09%0A%09%09if(cmd == null) %7B%0A%09%09%09System.err.println(%22CLI parser failed to initialise%22);%0A%09%09%09System.exit(-1);%0A%09%09%7D%0A%09%09%0A%09%09if(cmd.hasOption(%22help%22)) %7B%0A%09%09%09System.out.println(HELP_TEXT);%0A%09%09%7D%0A%09%09%0A%09%7D%0A%09%0A%09public static void main(String args%5B%5D) %7B%0A%09%09final String testArgs%5B%5D = %7B%22-help%22%7D;%0A%09%09%0A%09%09CommonsTest commonsTest = new CommonsTest();%0A%09%09commonsTest.parse(testArgs);
 %0A%09%7D%0A

Update commons cli experiment