public VaultTool(String[] args) { initOptions(); parser = new PosixParser(); try { cmdLine = parser.parse(options, args, true); } catch (ParseException e) { System.out.println(SecurityLogger.ROOT_LOGGER.problemParsingCommandLineParameters()); e.printStackTrace(System.err); System.exit(2); } }
public OptionsParser(String... args) { Options options = new Options(); options.addOption("plugins", true, "Directory from which to load a plugin bundle, can be used multiple times for different plugin bundles"); options.addOption("home", true, "The home directory to use, default is [cwd]/home"); CommandLineParser parser = new DefaultParser(); pluginDirectories = null; try { CommandLine cmd = parser.parse(options, args); if (cmd.hasOption("plugins")) { String[] plugins = cmd.getOptionValues("plugins"); pluginDirectories = new Path[plugins.length]; for (int i=0; i<plugins.length; i++) { pluginDirectories[i] = Paths.get(plugins[i]); if (!Files.isDirectory(pluginDirectories[i])) { throw new RuntimeException("plugins parameter must point to a directory (" + pluginDirectories[i] + ")"); } } } if (cmd.hasOption("home")) { home = Paths.get(cmd.getOptionValue("home")); } } catch (ParseException e) { e.printStackTrace(); } }
private static CommandLine parse(Options options, String[] args) { /* * The general gist is that in order to pass args to storm jar, * we have to disregard options that we don't know about in the CLI. * Storm will ignore our args, we have to do the same. */ CommandLineParser parser = new PosixParser() { @Override protected void processOption(String arg, ListIterator iter) throws ParseException { if(getOptions().hasOption(arg)) { super.processOption(arg, iter); } } }; try { return ParserOptions.parse(parser, args); } catch (ParseException pe) { pe.printStackTrace(); final HelpFormatter usageFormatter = new HelpFormatter(); usageFormatter.printHelp("ParserTopologyCLI", null, options, null, true); System.exit(-1); return null; } }
public static CommandLine parse(CommandLineParser parser, String[] args) throws ParseException { try { CommandLine cli = parser.parse(getOptions(), args); if(HELP.has(cli)) { printHelp(); System.exit(0); } return cli; } catch (ParseException e) { System.err.println("Unable to parse args: " + Joiner.on(' ').join(args)); e.printStackTrace(System.err); printHelp(); throw e; } }
public static CommandLine parse(CommandLineParser parser, String[] args) throws ParseException { try { CommandLine cli = parser.parse(getOptions(), args); if (HELP.has(cli)) { printHelp(); System.exit(0); } return cli; } catch (ParseException e) { System.err.println("Unable to parse args: " + Joiner.on(' ').join(args)); e.printStackTrace(System.err); printHelp(); throw e; } }
public static CommandLine parse(CommandLineParser parser, String[] args) throws ParseException { try { CommandLine cli = parser.parse(getOptions(), args); if(HELP.has(cli)) { printHelp(); System.exit(0); } return cli; } catch (ParseException e) { System.err.println("Unable to parse args: " + Joiner.on(' ').join(args)); e.printStackTrace(System.err); printHelp(); throw e; } }
public static CommandLine parse(CommandLineParser parser, String[] args) throws ParseException { try { CommandLine cli = parser.parse(getOptions(), args); if(HELP.has(cli)) { printHelp(); System.exit(0); } return cli; } catch (ParseException e) { System.err.println("Unable to parse args: " + Joiner.on(' ').join(args)); e.printStackTrace(System.err); printHelp(); throw e; } }
public static CommandLine parse(CommandLineParser parser, String[] args) throws ParseException { try { CommandLine cli = parser.parse(getOptions(), args); if(HELP.has(cli)) { printHelp(); System.exit(0); } return cli; } catch (ParseException e) { System.err.println("Unable to parse args: " + Joiner.on(' ').join(args)); e.printStackTrace(System.err); printHelp(); throw e; } }
public static CommandLine parse(CommandLineParser parser, String[] args) throws ParseException { try { CommandLine cli = parser.parse(getOptions(), args); if(HELP.has(cli)) { printHelp(); System.exit(0); } return cli; } catch (ParseException e) { System.err.println("Unable to parse args: " + Joiner.on(' ').join(args)); e.printStackTrace(System.err); printHelp(); throw e; } }
public static CommandLine parse(CommandLineParser parser, String[] args) { try { CommandLine cli = parser.parse(getOptions(), args); if (InspectorOptions.HELP.has(cli)) { printHelp(); System.exit(0); } return cli; } catch (ParseException e) { System.err.println("Unable to parse args: " + Joiner.on(' ').join(args)); e.printStackTrace(System.err); printHelp(); System.exit(-1); return null; } }
public static CommandLine parse(CommandLineParser parser, String[] args) { try { CommandLine cli = parser.parse(getOptions(), args); if(TaxiiOptions.HELP.has(cli)) { printHelp(); System.exit(0); } return cli; } catch (ParseException e) { System.err.println("Unable to parse args: " + Joiner.on(' ').join(args)); e.printStackTrace(System.err); printHelp(); System.exit(-1); return null; } }
public static CommandLine parse(CommandLineParser parser, String[] args) { try { CommandLine cli = parser.parse(getOptions(), args); if(BulkLoadOptions.HELP.has(cli)) { printHelp(); System.exit(0); } return cli; } catch (ParseException e) { System.err.println("Unable to parse args: " + Joiner.on(' ').join(args)); e.printStackTrace(System.err); printHelp(); System.exit(-1); return null; } }
public static CommandLine parse(CommandLineParser parser, String[] args) { try { CommandLine cli = parser.parse(getOptions(), args); if(ConfigurationOptions.HELP.has(cli)) { printHelp(); System.exit(0); } return cli; } catch (ParseException e) { System.err.println("Unable to parse args: " + Joiner.on(' ').join(args)); e.printStackTrace(System.err); printHelp(); System.exit(-1); return null; } }
public static CommandLine parse(CommandLineParser parser, String[] args) { try { CommandLine cli = parser.parse(getOptions(), args); if (MaxmindDbEnrichmentLoader.GeoEnrichmentOptions.HELP.has(cli)) { printHelp(); System.exit(0); } return cli; } catch (ParseException e) { System.err.println("Unable to parse args: " + Joiner.on(' ').join(args)); e.printStackTrace(System.err); printHelp(); System.exit(-1); return null; } }
public static CommandLine parse(CommandLineParser parser, String[] args) { try { CommandLine cli = parser.parse(getOptions(), args); if(HELP.has(cli)) { printHelp(); System.exit(0); } return cli; } catch (org.apache.commons.cli.ParseException e) { System.err.println("Unable to parse args: " + Joiner.on(' ').join(args)); e.printStackTrace(System.err); printHelp(); System.exit(-1); return null; } }
public static CommandLine parse(String name, CommandLineParser parser, String[] args, CLIOptions[] values, CLIOptions helpOption) { try { CommandLine cli = parser.parse(getOptions(values), args); if(helpOption.has(cli)) { printHelp(name, values); System.exit(0); } return cli; } catch (ParseException e) { System.err.println("Unable to parse args: " + Joiner.on(' ').join(args)); e.printStackTrace(System.err); printHelp(name, values); System.exit(-1); return null; } } }
pe.printStackTrace(); final HelpFormatter usageFormatter = new HelpFormatter(); usageFormatter.printHelp(LatencySummarizer.class.getSimpleName().toLowerCase(), null, options, null, true);
/** * Extracts the valid command line options from a given command line. * * @param parser The command line parser. * @param args The command line to parse. * @return The command line options. * @throws ParseException If the command line cannot be parsed successfully. */ public static CommandLine parse(CommandLineParser parser, String[] args) throws ParseException { try { CommandLine cli = parser.parse(getOptions(), args); if(HELP.has(cli)) { printHelp(); System.exit(0); } return cli; } catch (ParseException e) { System.err.println("invalid arguments: " + Joiner.on(' ').join(args)); e.printStackTrace(System.err); printHelp(); throw e; } }
public static CommandLine parse(CommandLineParser parser, String[] args) { try { CommandLine cli = parser.parse(getOptions(), args); if(HELP.has(cli)) { printHelp(); System.exit(0); } return cli; } catch (ParseException e) { System.err.println("Unable to parse args: " + Joiner.on(' ').join(args)); e.printStackTrace(System.err); printHelp(); System.exit(-1); return null; } }
cmd = ParserOptions.parse(parser, args); } catch (ParseException pe) { pe.printStackTrace(); final HelpFormatter usageFormatter = new HelpFormatter(); usageFormatter.printHelp("HLLPMeasurement", null, options, null, true);