private void printUsage(Object options) { CmdLineParser parser = new CmdLineParser(options); StringWriter sw = new StringWriter(); sw.append(USAGE_PREFIX + "\n"); sw.append(ALT_USAGE_PREFIX + " <source> <destination>\n"); sw.append(ALT_USAGE_PREFIX + " [OPTION]... [<value>...]\n\n"); sw.append("Options:"); System.out.println(sw.toString()); parser.getProperties().withUsageWidth(100); parser.printUsage(System.out); }
private void printUsage(Object options) { CmdLineParser parser = new CmdLineParser(options); StringWriter sw = new StringWriter(); sw.append(USAGE_PREFIX + "\n"); sw.append(ALT_USAGE_PREFIX + " <source> <destination>\n"); sw.append(ALT_USAGE_PREFIX + " [OPTION]... [<value>...]\n\n"); sw.append("Options:"); System.out.println(sw.toString()); parser.getProperties().withUsageWidth(100); parser.printUsage(System.out); }
public ArgsUtil(AppAbortStrategy strategy, BasicOptions opts) { this.abortStrategy = strategy; this.opts = opts; this.parser = new CmdLineParser(opts); try { parser.getProperties() .withUsageWidth(Integer.parseInt(System.getenv("COLUMNS"))); } catch (Exception e) { parser.getProperties().withUsageWidth(120); } }
public ArgsUtil(AppAbortStrategy strategy, BasicOptions opts) { this.abortStrategy = strategy; this.opts = opts; this.parser = new CmdLineParser(opts); try { parser.getProperties() .withUsageWidth(Integer.parseInt(System.getenv("COLUMNS"))); } catch (Exception e) { parser.getProperties().withUsageWidth(120); } }
public static void printUsage(CmdLineParser parser, OptionHandlerFilter filter, PrintStream out) { parser.getProperties().withUsageWidth(USAGE_WIDTH); parser.printUsage(new OutputStreamWriter(out), null, filter); }
/** * Launcher * * @param args the CLI arguments * @throws IOException */ @SuppressWarnings("squid:S1166") public static void main(String[] args) throws IOException { opts = new Options(); // Parse the cmdline arguments CmdLineParser cli = new CmdLineParser(opts); try { cli.getProperties().withUsageWidth(80); cli.parseArgument(args); } catch (@SuppressWarnings("unused") CmdLineException ex) { cli.printUsage(System.err); System.exit(1); } Runtime runtime = Runtime.getRuntime(); int mb = 1024 * 1024; out(1, "Total Memory: %d%n", runtime.totalMemory() / mb); out(1, "Max Memory: %d%n", runtime.maxMemory() / mb); Parameters ps = opts.parameters(); Iterator<LabelledInstance> ite = opts.instances().iterator(); while (ite.hasNext()) { LabelledInstance i = ite.next(); solve(i, ps); } }