Package org.apache.commons.cli

Examples of org.apache.commons.cli.CommandLineParser


    options.addOption(opt);
    options.addOption(opt);
    opt = new Option("t", true, "capacity of the channel");
    opt.setRequired(true);
    options.addOption(opt);
    CommandLineParser parser = new GnuParser();
    CommandLine cli = parser.parse(options, args);
    File checkpointDir = new File(cli.getOptionValue("c"));
    String[] logDirs = cli.getOptionValue("l").split(",");
    List<File> logFiles = Lists.newArrayList();
    for (String logDir : logDirs) {
      File[] files = new File(logDir).listFiles();
View Full Code Here


        .addOption(null, "dirname", true, "directory to stream to avro source")
        .addOption("R", "headerFile", true, ("file containing headers as " +
            "key/value pairs on each new line"))
        .addOption("h", "help", false, "display help text");

    CommandLineParser parser = new GnuParser();
    CommandLine commandLine = parser.parse(options, args);

    if (commandLine.hasOption('h')) {
      new HelpFormatter().printHelp("flume-ng avro-client", "", options,
          "The --dirname option assumes that a spooling directory exists " +
          "where immutable log files are dropped.", true);
View Full Code Here

   
    public static void main(String[] args) throws Exception {
      Options options = getOptions();
      try {
       
        CommandLineParser parser = new GnuParser();

        CommandLine line = parser.parse( options, args );
        File dir = new File(line.getOptionValue("dir", "."));
        Collection files = ListFile.list(dir);
        System.out.println("listing files in "+dir);
        for (Iterator it = files.iterator(); it.hasNext(); ) {
          System.out.println("\t"+it.next()+"\n");
View Full Code Here

      if (args.length == 0) {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp("HFile ", options, true);
        System.exit(-1);
      }
      CommandLineParser parser = new PosixParser();
      CommandLine cmd = parser.parse(options, args);
      boolean verbose = cmd.hasOption("v");
      boolean printKeyValue = cmd.hasOption("p");
      boolean printMeta = cmd.hasOption("m");
      boolean checkRow = cmd.hasOption("k");
      boolean checkFamily = cmd.hasOption("a");
View Full Code Here

      return _usage;
    }

    public boolean processCommandLineArgs(String[] cliArgs) throws IOException, DatabusException
    {
      CommandLineParser cliParser = new GnuParser();
      _cmd = null;

      try
      {
        _cmd = cliParser.parse(_cliOptions, cliArgs);
      } catch (ParseException pe)
      {
        System.err.println(NAME + ": failed to parse command-line options: " + pe.toString());
        printCliHelp();
        return false;
View Full Code Here

    return options;
  }

  protected static String[] processLocalArgs(String[] cliArgs) throws IOException, ParseException
  {
    CommandLineParser cliParser = new GnuParser();
    Options cliOptions = constructCommandLineOptions();

    CommandLine cmd = cliParser.parse(cliOptions, cliArgs, true);
    // Options here has to be up front
    if (cmd.hasOption(RELAY_HOST_OPT_NAME))
    {
      _relayHost = cmd.getOptionValue(RELAY_HOST_OPT_NAME);
      LOG.info("Relay Host = " + _relayHost);
View Full Code Here

    public void processCommandLineArgs(String[] cliArgs) throws IOException, DatabusException
    {
      constructCommandLineOptions();

      CommandLineParser cliParser = new GnuParser();

      _cmd = null;
      try
      {
        _cmd = cliParser.parse(_cliOptions, cliArgs);
      }
      catch (ParseException pe)
      {
        System.err.println("HttpServer: failed to parse command-line options: " + pe.toString());
        printCliHelp();
View Full Code Here

    String rawDataPath = "";
    String tempTsvPath = "";
    String originalTSVPath = "";
    String sdmxTTLFile = "";
   
    CommandLineParser parser = new BasicParser( );
    Options options = new Options( );
    options.addOption("h", "help", false, "Print this usage information");
    options.addOption("i", "file path", true, "Input file path of the TableOfContents.xml file.");
    options.addOption("o", "output file path", true, "Output directory path where the new TableOfContents.xml file will be saved.");
    options.addOption("f", "log file path", true, "Output directory path where the log of updates will be stored.");
    options.addOption("z", "temp zip path", true, "Directory path where zip files will be temporarily stored.");
    options.addOption("v", "temp tsv path", true, "Directory path where tsv files will be temporarily stored.");
    options.addOption("t", "temp data path", true, "Directory path where the sdmx and dsd files will be temporarily stored.");
    options.addOption("s", "sdmx file path", true, "Output directory path to generate DataCube representation of observations.");
    options.addOption("d", "dsd file path", true, "Output directory path to generate DataCube representation of DSD.");
    options.addOption("l", "data log path", true, "File path where the logs will be written.");
    options.addOption("p", "original data path", true, "Path where zip files will be stored.");
    options.addOption("b", "original tsv path", true, "Path where tsv files will be stored.");
    options.addOption("r", "raw data path", true, "Path where the uncompressed files will be stored.");
    options.addOption("a", "sdmx ttl file", true, "Path where the sdmx ttl is located.");
    CommandLine commandLine = parser.parse( options, args );
   
    if( commandLine.hasOption('h') ) {
        usage();
        return;
     }
View Full Code Here

  }

  @SuppressWarnings("static-access")
  public static Config parseArgs(String[] args) throws Exception
  {
    CommandLineParser cliParser = new GnuParser();


    Option helpOption = OptionBuilder.withLongOpt(HELP_OPT_LONG_NAME)
        .withDescription("Help screen")
        .create(HELP_OPT_CHAR);

    Option sourceIdOption = OptionBuilder.withLongOpt(SOURCE_ID_OPT_LONG_NAME)
        .withDescription("Source ID for which tables need to be added")
        .hasArg()
        .withArgName("Source ID")
        .create(SOURCE_ID_OPT_CHAR);

    Option sourceNameOption = OptionBuilder.withLongOpt(SOURCE_NAME_OPT_LONG_NAME)
        .withDescription("Source Name for which tables need to be added")
        .hasArg()
        .withArgName("Source ID")
        .create(SOURCE_NAME_OPT_CHAR);

    Option dbOption = OptionBuilder.withLongOpt(BOOTSTRAP_DB_PROPS_OPT_LONG_NAME)
        .withDescription("Bootstrap producer properties to use")
        .hasArg()
        .withArgName("property_file")
        .create(BOOTSTRAP_DB_PROP_OPT_CHAR);

    Option cmdLinePropsOption = OptionBuilder.withLongOpt(CMD_LINE_PROPS_OPT_LONG_NAME)
        .withDescription("Cmd line override of config properties. Semicolon separated.")
        .hasArg()
        .withArgName("Semicolon_separated_properties")
        .create(CMD_LINE_PROPS_OPT_CHAR);

    Option log4jPropsOption = OptionBuilder.withLongOpt(LOG4J_PROPS_OPT_LONG_NAME)
        .withDescription("Log4j properties to use")
        .hasArg()
        .withArgName("property_file")
        .create(LOG4J_PROPS_OPT_CHAR);

    Options options = new Options();
    options.addOption(helpOption);
    options.addOption(sourceIdOption);
    options.addOption(sourceNameOption);
    options.addOption(dbOption);
    options.addOption(cmdLinePropsOption);
    options.addOption(log4jPropsOption);

    CommandLine cmd = null;
    try
    {
      cmd = cliParser.parse(options, args);
    }
    catch (ParseException pe)
    {
      LOG.error("Bootstrap Physical Config: failed to parse command-line options.", pe);
      throw new RuntimeException("Bootstrap Physical Config: failed to parse command-line options.", pe);
View Full Code Here

  {
    String fileName = "";
    String sdmxFilePath = "";
    String tsvFilePath = "";
   
    CommandLineParser parser = new BasicParser( );
    Options options = new Options( );
    options.addOption("h", "help", false, "Print this usage information");
    options.addOption("f", "filename", true, "Name of the file.");
    options.addOption("i", "file path", true, "File path of the SDMX xml file.");
    options.addOption("t", "tsv file path", true, "File path of the SDMX tsv file.");
    options.addOption("o", "output file path", true, "Output directory path to generate DataCube representation of observations");
    options.addOption("l", "log file path", true, "File path where the logs will be written.");
   
    CommandLine commandLine = parser.parse( options, args );
   
    if( commandLine.hasOption('h') ) {
        usage();
        return;
     }
View Full Code Here

TOP

Related Classes of org.apache.commons.cli.CommandLineParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.