@@ -0,0 +1,1903 @@
+package exporter.examples;%0A%0Aimport org.apache.commons.cli.BasicParser;%0Aimport org.apache.commons.cli.CommandLine;%0Aimport org.apache.commons.cli.HelpFormatter;%0Aimport org.apache.commons.cli.OptionBuilder;%0Aimport org.apache.commons.cli.Options;%0Aimport org.apache.commons.cli.ParseException;%0A%0Apublic class Ls %7B%0A%09@SuppressWarnings(%22static-access%22)%0A%09public static Options generateOptions() %7B%0A%0A%09%09Options options = new Options();%0A%09%09options.addOption(%22a%22, %22all%22, false,%0A%09%09%09%09%22do not hide entries starting with .%22);%0A%09%09options.addOption(%22A%22, %22almost-all%22, false,%0A%09%09%09%09%22do not list implied . and ..%22);%0A%09%09options.addOption(%22b%22, %22escape%22, false,%0A%09%09%09%09%22print octal escapes for nongraphic %22 + %22characters%22);%0A%09%09options.addOption(OptionBuilder.withLongOpt(%22block-size%22)%0A%09%09%09%09.withDescription(%22use SIZE-byte blocks%22).hasArg()%0A%09%09%09%09.withArgName(%22SIZE%22).create());%0A%09%09options.addOption(%22B%22, %22ignore-backups%22, false,%0A%09%09%09%09%22do not list implied entried %22 + %22ending with ~%22);%0A%09%09options.addOption(%22c%22, false,%0A%09%09%09%09%22with -lt: sort by, and show, ctime (time of last %22%0A%09%09%09%09%09%09+ %22modification of file status information) with %22%0A%09%09%09%09%09%09+ %22-l:show ctime and sort by name otherwise: sort %22%0A%09%09%09%09%09%09+ %22by ctime%22);%0A%09%09options.addOption(%22C%22, false, %22list entries by columns%22);%0A%0A%09%09return options;%0A%09%7D%0A%0A%09public static void main(String%5B%5D args) %7B%0A%09%09Options options = generateOptions();%0A%0A%09%09BasicParser parser = new BasicParser();%0A%09%09try %7B%0A%09%09%09// parse the command line arguments%0A%09%09%09CommandLine line = parser.parse(options, args);%0A%0A%09%09%09// validate that block-size has been set%0A%09%09%09if (line.hasOption(%22block-size%22)) %7B%0A%09%09%09%09// print the value of block-size%0A%09%09%09%09System.out.println(line.getOptionValue(%22block-size%22));%0A%09%09%09%7D%0A%09%09%7D catch (ParseException exp) %7B%0A%09%09%09System.out.println(%22Unexpected exception:%22 + exp.getMessage());%0A%09%09%7D%0A%09%09// automatically generate the help statement%0A%09%09HelpFormatter formatter = new HelpFormatter();%0A%09%09formatter.printHelp(%22ls%22, options);%0A%09%7D%0A%0A%7D%0A

Add another CLI example