List of usage examples for org.apache.commons.cli2.util HelpFormatter setException
public void setException(OptionException exception)
From source file:org.apache.mahout.common.CommandLineUtil.java
public static void printHelpWithGenericOptions(Group group, OptionException oe) throws IOException { new GenericOptionsParser(new Configuration(), new org.apache.commons.cli.Options(), new String[0]); PrintWriter pw = new PrintWriter(new OutputStreamWriter(System.out, Charsets.UTF_8), true); HelpFormatter formatter = new HelpFormatter(); formatter.setGroup(group);/*from w ww . j ava2 s.c om*/ formatter.setPrintWriter(pw); formatter.setException(oe); formatter.print(); }
From source file:org.opencloudengine.flamingo.mapreduce.util.CommandLineUtil.java
public static void printHelpWithGenericOptions(Group group, OptionException oe) throws IOException { Options ops = new Options(); new GenericOptionsParser(new Configuration(), ops, new String[0]); org.apache.commons.cli.HelpFormatter fmt = new org.apache.commons.cli.HelpFormatter(); fmt.printHelp("<command> [Generic Options] [Job-Specific Options]", "Generic Options:", ops, ""); PrintWriter pw = new PrintWriter(System.out, true); HelpFormatter formatter = new HelpFormatter(); formatter.setGroup(group);//from w w w. j a va 2 s . c o m formatter.setPrintWriter(pw); formatter.setException(oe); formatter.print(); pw.flush(); }