当前位置: 首页>>代码示例>>Java>>正文


Java PosixParser.parse方法代码示例

本文整理汇总了Java中org.apache.commons.cli.PosixParser.parse方法的典型用法代码示例。如果您正苦于以下问题:Java PosixParser.parse方法的具体用法?Java PosixParser.parse怎么用?Java PosixParser.parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.commons.cli.PosixParser的用法示例。


在下文中一共展示了PosixParser.parse方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: parse

import org.apache.commons.cli.PosixParser; //导入方法依赖的package包/类
/**
 * Parses the command line options
 * 
 * @return false if need to print help output
 * 
 * @throws Exception
 *           when parsing fails
 */
ParsedOutput parse() throws Exception {
  if (parsed == null) {
    PosixParser parser = new PosixParser();
    CommandLine popts = parser.parse(getOptionList(), argumentList, true);
    if (popts.hasOption(ConfigOption.HELP.getOpt())) {
      parsed = new ParsedOutput(null, this, true);
    } else {
      parsed = new ParsedOutput(popts, this, false);
    }
  }
  return parsed;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:ArgumentParser.java

示例2: getCommandLine

import org.apache.commons.cli.PosixParser; //导入方法依赖的package包/类
public static CommandLine getCommandLine( Options options, String[] args )
		throws ParseException {

	PosixParser parser = new PosixParser();
	CommandLine cmd = parser.parse( options, args );
	return cmd;
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:8,代码来源:CLI.java

示例3: testOrder

import org.apache.commons.cli.PosixParser; //导入方法依赖的package包/类
@Test
public void testOrder() throws ParseException {
    Option optionA = new Option("a", "first");
    Options opts = new Options();
    opts.addOption(optionA);
    PosixParser posixParser = new PosixParser();
    CommandLine line = posixParser.parse(opts, null);
    assertFalse(line.hasOption(null));
}
 
开发者ID:cchabanois,项目名称:mesfavoris,代码行数:10,代码来源:BugCLI133Test.java

示例4: buildCommandline

import org.apache.commons.cli.PosixParser; //导入方法依赖的package包/类
public static CommandLine buildCommandline(String[] args) {
    final Options options = new Options();
    Option opt = new Option("h", "help", false, "Print help");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("g", "consumerGroup", true, "Consumer Group Name");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option("t", "topic", true, "Topic Name");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option("s", "subscription", true, "subscription");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("f", "returnFailedHalf", true, "return failed result, for half message");
    opt.setRequired(true);
    options.addOption(opt);

    PosixParser parser = new PosixParser();
    HelpFormatter hf = new HelpFormatter();
    hf.setWidth(110);
    CommandLine commandLine = null;
    try {
        commandLine = parser.parse(options, args);
        if (commandLine.hasOption('h')) {
            hf.printHelp("producer", options, true);
            return null;
        }
    } catch (ParseException e) {
        hf.printHelp("producer", options, true);
        return null;
    }

    return commandLine;
}
 
开发者ID:apache,项目名称:rocketmq,代码行数:40,代码来源:Consumer.java

示例5: processOptions

import org.apache.commons.cli.PosixParser; //导入方法依赖的package包/类
private static void processOptions(String[] args)
{
   Options options = new Options();

   Option opt = new Option("in", true,
            "Input file oe-supported Use .sdf to specify the file type.");
   opt.setRequired(true);
   options.addOption(opt);

   opt = new Option("out", true,
            "Output file oe-supported Use .sdf to specify the file type.");
   opt.setRequired(true);
   options.addOption(opt);

   opt = new Option("bin", true,
            "bin definition. Use format \"bin_1_upperbound=bin_1_name|bin_2_upperbound=bin_2_name|bin_3_upperbound_=bin_3_name\"");
   opt.setRequired(true);
   options.addOption(opt);

   opt = new Option("dataTag", true,
            "SD tag containing data for binning");
   opt.setRequired(true);
   options.addOption(opt);

   opt = new Option("binTag", true,
            "SD tag used for storing bin names");
   opt.setRequired(true);
   options.addOption(opt);

   opt = new Option("ignoreModifier", false,
            "ignore leading '><= ~'");
   options.addOption(opt);

   opt = new Option("h", false,
            "print usage statement");
   opt.setRequired(false);
   options.addOption(opt);


   PosixParser parser = new PosixParser();
   CommandLine cl=null;

   try {
      cl = parser.parse(options, args);
   } catch (Exception exp) {
      // catch (ParseException exp) {
      System.err.println(exp.getMessage());
      exitWithHelp(options);
   }
   inFile = cl.getOptionValue("in");
   outFile = cl.getOptionValue("out");
   ignoreModifier = cl.hasOption("ignoreModifier");
   String binDefinition=cl.getOptionValue("bin");
   parseBins(binDefinition);

   binTag=cl.getOptionValue("binTag");
   dataTag=cl.getOptionValue("dataTag");
}
 
开发者ID:chemalot,项目名称:chemalot,代码行数:59,代码来源:SDFBinning.java

示例6: buildCommandline

import org.apache.commons.cli.PosixParser; //导入方法依赖的package包/类
public static CommandLine buildCommandline(String[] args) {
    final Options options = new Options();
    // ////////////////////////////////////////////////////
    Option opt = new Option("h", "help", false, "Print help");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("g", "consumerGroup", true, "Consumer Group Name");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option("t", "topic", true, "Topic Name");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option("s", "subscription", true, "subscription");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("f", "returnFailedHalf", true, "return failed result, for half message");
    opt.setRequired(true);
    options.addOption(opt);

    // ////////////////////////////////////////////////////

    PosixParser parser = new PosixParser();
    HelpFormatter hf = new HelpFormatter();
    hf.setWidth(110);
    CommandLine commandLine = null;
    try {
        commandLine = parser.parse(options, args);
        if (commandLine.hasOption('h')) {
            hf.printHelp("producer", options, true);
            return null;
        }
    }
    catch (ParseException e) {
        hf.printHelp("producer", options, true);
        return null;
    }

    return commandLine;
}
 
开发者ID:medusar,项目名称:rocketmq-commet,代码行数:44,代码来源:Consumer.java

示例7: buildCommandline

import org.apache.commons.cli.PosixParser; //导入方法依赖的package包/类
public static CommandLine buildCommandline(String[] args) {
    final Options options = new Options();
    // ////////////////////////////////////////////////////
    Option opt = new Option("h", "help", false, "Print help");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("g", "producerGroup", true, "Producer Group Name");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option("t", "topic", true, "Topic Name");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option("a", "tags", true, "Tags Name");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option("k", "keys", true, "Keys Name");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option("c", "msgCount", true, "Message Count");
    opt.setRequired(true);
    options.addOption(opt);

    // ////////////////////////////////////////////////////

    PosixParser parser = new PosixParser();
    HelpFormatter hf = new HelpFormatter();
    hf.setWidth(110);
    CommandLine commandLine = null;
    try {
        commandLine = parser.parse(options, args);
        if (commandLine.hasOption('h')) {
            hf.printHelp("producer", options, true);
            return null;
        }
    }
    catch (ParseException e) {
        hf.printHelp("producer", options, true);
        return null;
    }

    return commandLine;
}
 
开发者ID:medusar,项目名称:rocketmq-commet,代码行数:48,代码来源:Producer.java

示例8: buildCommandline

import org.apache.commons.cli.PosixParser; //导入方法依赖的package包/类
public static CommandLine buildCommandline(String[] args) {
    final Options options = new Options();
    Option opt = new Option("h", "help", false, "Print help");
    opt.setRequired(false);
    options.addOption(opt);

    opt = new Option("g", "producerGroup", true, "Producer Group Name");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option("t", "topic", true, "Topic Name");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option("a", "tags", true, "Tags Name");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option("k", "keys", true, "Keys Name");
    opt.setRequired(true);
    options.addOption(opt);

    opt = new Option("c", "msgCount", true, "Message Count");
    opt.setRequired(true);
    options.addOption(opt);

    PosixParser parser = new PosixParser();
    HelpFormatter hf = new HelpFormatter();
    hf.setWidth(110);
    CommandLine commandLine = null;
    try {
        commandLine = parser.parse(options, args);
        if (commandLine.hasOption('h')) {
            hf.printHelp("producer", options, true);
            return null;
        }
    } catch (ParseException e) {
        hf.printHelp("producer", options, true);
        return null;
    }

    return commandLine;
}
 
开发者ID:apache,项目名称:rocketmq,代码行数:44,代码来源:Producer.java


注:本文中的org.apache.commons.cli.PosixParser.parse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。