private static void printUsage(String errorMessage, Options options) { Preconditions.checkNotNull(options, "command line options were not specified"); if (errorMessage != null) { System.out.println(errorMessage + System.lineSeparator()); } HelpFormatter helpFormatter = new HelpFormatter(); helpFormatter.setWidth(160); helpFormatter.setDescPadding(0); helpFormatter.printHelp(ZooKeeperMigratorMain.class.getCanonicalName(), HEADER, options, FOOTER, true); }
@Test public void testAccessors() { HelpFormatter formatter = new HelpFormatter(); formatter.setArgName("argname"); assertEquals("arg name", "argname", formatter.getArgName()); formatter.setDescPadding(3); assertEquals("desc padding", 3, formatter.getDescPadding()); formatter.setLeftPadding(7); assertEquals("left padding", 7, formatter.getLeftPadding()); formatter.setLongOptPrefix("~~"); assertEquals("long opt prefix", "~~", formatter.getLongOptPrefix()); formatter.setNewLine("\n"); assertEquals("new line", "\n", formatter.getNewLine()); formatter.setOptPrefix("~"); assertEquals("opt prefix", "~", formatter.getOptPrefix()); formatter.setSyntaxPrefix("-> "); assertEquals("syntax prefix", "-> ", formatter.getSyntaxPrefix()); formatter.setWidth(80); assertEquals("width", 80, formatter.getWidth()); }
private static void printUsage(String errorMessage, Options options) { Preconditions.checkNotNull(options, "command line options were not specified"); if (errorMessage != null) { System.out.println(errorMessage + System.lineSeparator()); } HelpFormatter helpFormatter = new HelpFormatter(); helpFormatter.setWidth(160); helpFormatter.setDescPadding(0); helpFormatter.printHelp(ZooKeeperMigratorMain.class.getCanonicalName(), HEADER, options, FOOTER, true); }
private void printHelp() { String header = "Sign and timestamp a Windows executable file.\n\n"; String footer = "\nPlease report suggestions and issues on the GitHub project at https://github.com/ebourg/jsign/issues"; HelpFormatter formatter = new HelpFormatter(); formatter.setOptionComparator(null); formatter.setWidth(85); formatter.setDescPadding(1); formatter.printHelp("java -jar jsign.jar [OPTIONS] FILE", header, options, footer); } }
private static void printHelp(Options options) { HelpFormatter help = new HelpFormatter(); help.setWidth(120); help.setLeftPadding(4); help.setDescPadding(3); help.printHelp("-" + ARG_INSTALL + " <apk file/folder> | -" + ARG_UNINSTALL + " <package filter> | -" + ARG_BUGREPORT + " <out folder> | -" + ARG_FORCE_STOP + " <package filter> | -" + ARG_CLEAR_DATA + " <package filter> | " + ARG_APPINFO + " <package filter> | --help", "Version:" + CmdUtil.jarVersion(), options, " ", false); } }
HelpFormatter formatter = new HelpFormatter(); formatter.setLeftPadding(4); formatter.setDescPadding(8); try { Map keys = (Map) dec.readObject();