org.kohsuke.args4j.OptionHandlerFilter Java Examples
The following examples show how to use
org.kohsuke.args4j.OptionHandlerFilter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntryPoint.java From pst-digger with GNU General Public License v3.0 | 5 votes |
/** * Perform the job * * @param args Command line */ @SuppressWarnings("boxing") private void doMain(String[] args) { CmdLineParser parser = new CmdLineParser(this); try { // Parse the arguments parser.getProperties().withUsageWidth(120); parser.parseArgument(args); // Create ouptut folder if ((this.output != null) && !this.output.exists()) { this.output.mkdirs(); } // Dig the file LOG.info("Start digging on file '{}' ...", this.pst); int count = new Digger(this.caseSensitive, this.searchedKeywords, this.pst, this.output, this.dumpAttachments).dig(); LOG.info("Digging finished, {} interesting mails found, see folder '{}' for details !", count, this.output.getAbsolutePath()); } catch (CmdLineException cmde) { LOG.error("Bad syntax !"); LOG.error(" "); LOG.error("Usage:"); parser.printUsage(System.out); LOG.error(" "); String baseCmd = "java -jar pst-digger.jar"; LOG.error("Example using required parameters:"); LOG.error(baseCmd + parser.printExample(OptionHandlerFilter.REQUIRED)); LOG.error(" "); LOG.error("Example using all parameters:"); LOG.error(baseCmd + parser.printExample(OptionHandlerFilter.ALL)); LOG.error(" "); } catch (Exception e) { LOG.error("Digging failed !", e); } }
Example #2
Source File: Repl.java From es6draft with MIT License | 5 votes |
private static String getUsageString(CmdLineParser parser, boolean showAll) { ResourceBundle rb = getResourceBundle(); StringWriter writer = new StringWriter(); writer.write(formatMessage(rb, "usage", getVersionString(), PROGRAM_NAME)); parser.printUsage(writer, rb, showAll ? OptionHandlerFilter.ALL : OptionHandlerFilter.PUBLIC); return writer.toString(); }
Example #3
Source File: PluginBasedCommandHelpPrinter.java From buck with Apache License 2.0 | 5 votes |
private void printSubCommandUsage( PrintStream stream, OutputStreamWriter writer, PluginBasedSubCommand cmd, CmdLineParserWithPrintInformation subCommandParser, String typeOptionName, int len) { String message = cmd.getShortDescription() != null ? " (" + cmd.getShortDescription() + ")" : ""; stream.println("Options for " + typeOptionName + " " + cmd.getOptionValue() + message + ":"); subCommandParser.printUsage(writer, OptionHandlerFilter.PUBLIC, len); stream.println(); }
Example #4
Source File: FileSystemVerifyCommand.java From s3mper with Apache License 2.0 | 5 votes |
@Override public void execute(Configuration conf, String[] args) throws Exception { CmdLineParser parser = new CmdLineParser(this); String keyId = conf.get("fs.s3n.awsAccessKeyId"); String keySecret = conf.get("fs.s3n.awsSecretAccessKey"); s3 = new AmazonS3Client(new BasicAWSCredentials(keyId, keySecret)); try { parser.parseArgument(args); ExecutorService executor = Executors.newFixedThreadPool(threads); List<Future> futures = new ArrayList<Future>(); BufferedReader fin = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF8")); try { for(String line = fin.readLine(); line != null; line = fin.readLine()) { futures.add(executor.submit(new FileCheckTask(new Path(line.trim())))); } } finally { fin.close(); } for(Future f : futures) { f.get(); } executor.shutdown(); } catch (CmdLineException e) { System.err.println(e.getMessage()); System.err.println("s3mper fs verify [options]"); // print the list of available options parser.printUsage(System.err); System.err.println(); System.err.println(" Example: s3mper fs verify "+parser.printExample(OptionHandlerFilter.ALL)); } }
Example #5
Source File: MetastoreTimeseriesDeleteCommand.java From s3mper with Apache License 2.0 | 5 votes |
@Override public void execute(Configuration conf, String[] args) throws Exception { CmdLineParser parser = new CmdLineParser(this); try { parser.parseArgument(args); } catch (CmdLineException e) { System.err.println(e.getMessage()); System.err.println("s3mper meta delete_ts [options]"); // print the list of available options parser.printUsage(System.err); System.err.println(); System.err.println(" Example: s3mper meta delete_ts "+parser.printExample(OptionHandlerFilter.ALL)); return; } MetastoreJanitor janitor = new MetastoreJanitor(); janitor.initalize(PathUtil.S3N, conf); janitor.setScanLimit(readUnits); janitor.setDeleteLimit(writeUnits); janitor.setScanThreads(scanThreads); janitor.setDeleteThreads(deleteThreads); janitor.deleteTimeseries(TimeUnit.valueOf(unitType.toUpperCase()), unitCount); }
Example #6
Source File: MetastorePathDeleteCommand.java From s3mper with Apache License 2.0 | 5 votes |
@Override public void execute(Configuration conf, String[] args) throws Exception { CmdLineParser parser = new CmdLineParser(this); try { parser.parseArgument(args); } catch (CmdLineException e) { System.err.println(e.getMessage()); System.err.println("java SampleMain [options...] arguments..."); // print the list of available options parser.printUsage(System.err); System.err.println(); System.err.println(" Example: s3mper metastore "+parser.printExample(OptionHandlerFilter.ALL)); return; } MetastoreJanitor janitor = new MetastoreJanitor(); janitor.initalize(PathUtil.S3N, conf); janitor.setScanLimit(readUnits); janitor.setDeleteLimit(writeUnits); janitor.setScanThreads(scanThreads); janitor.setDeleteThreads(deleteThreads); janitor.deletePaths(TimeUnit.valueOf(unitType.toUpperCase()), unitCount); }