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


Java CmdLineParser.printUsage方法代码示例

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


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

示例1: printUsage

import org.kohsuke.args4j.CmdLineParser; //导入方法依赖的package包/类
/**
 * Print out the general syntax for the command line.
 */
private static void printUsage (CmdLineParser parser)
{
    StringBuilder buf = new StringBuilder();

    buf.append("\n");
    buf.append("\nSyntax:");
    buf.append("\n   [OPTIONS] -- [INPUT_FILES]\n");

    buf.append("\[email protected]:");
    buf.append("\n Content to be extended in line");
    buf.append("\n");

    buf.append("\nOptions:\n");

    StringWriter writer = new StringWriter();
    parser.printUsage(writer, null);
    buf.append(writer.toString());

    buf.append("\nInput file extensions:");
    buf.append("\n .xml: annotations file");
    buf.append("\n");
    logger.info(buf.toString());
}
 
开发者ID:Audiveris,项目名称:omr-dataset-tools,代码行数:27,代码来源:CLI.java

示例2: main

import org.kohsuke.args4j.CmdLineParser; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
    Consumer consumer = new Consumer();
    CmdLineParser parser = new CmdLineParser(consumer);

    try {
        parser.parseArgument(args);
    } catch (CmdLineException ce) {
        System.err.println(ce.getMessage());
        System.err.println();
        System.err.println(" Options are:");
        parser.printUsage(System.err); // print the list of available options
        System.err.println();
        System.exit(0);
    }

    consumer.run();
}
 
开发者ID:javaronok,项目名称:kafka-mgd-sample,代码行数:18,代码来源:Consumer.java

示例3: main

import org.kohsuke.args4j.CmdLineParser; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
    Producer producer = new Producer();
    CmdLineParser parser = new CmdLineParser(producer);

    try {
        parser.parseArgument(args);
    } catch (CmdLineException ce) {
        System.err.println(ce.getMessage());
        System.err.println();
        System.err.println(" Options are:");
        parser.printUsage(System.err); // print the list of available options
        System.err.println();
        System.exit(0);
    }

    producer.run();
}
 
开发者ID:javaronok,项目名称:kafka-mgd-sample,代码行数:18,代码来源:Producer.java

示例4: doMain

import org.kohsuke.args4j.CmdLineParser; //导入方法依赖的package包/类
private void doMain(final String[] arguments) throws IOException
{
   final CmdLineParser parser = new CmdLineParser(this);
   if (arguments.length < 1)
   {
      parser.printUsage(out);
      System.exit(-1);
   }
   try
   {
      parser.parseArgument(arguments);
   }
   catch (CmdLineException clEx)
   {
      out.println("ERROR: Unable to parse command-line options: " + clEx);
   }
   out.println("The file '" + fileName + "' was provided and verbosity is set to '" + verbose + "'.");
}
 
开发者ID:dustinmarx,项目名称:java-cli-demos,代码行数:19,代码来源:Main.java

示例5: parse

import org.kohsuke.args4j.CmdLineParser; //导入方法依赖的package包/类
/** Parse the command line options. 
 * @param args the command line args as passed to the main method of the
 * program.
 * @return the parsed command line options or {@code null} if
 * the program needs to exit. {@code null} will be returned
 * if the command lines are wrong or the command line help
 * was displayed.
 */
public static Params parse(String[] args) {
    Params result = new Params();
    CmdLineParser cmdLineParser = new CmdLineParser(result);
    try {
        if (log.isDebugEnabled()) {
            log.debug("Args: {}", Arrays.toString(args));
        }
        
        cmdLineParser.parseArgument(args);
        
        if (result.help) {
            cmdLineParser.printUsage(System.err);
            return null;
        }
                    
        return result;
    } catch (CmdLineException ex) {
        log.warn("Error in parsing", ex);
        System.err.println(ex.getMessage());
        cmdLineParser.printUsage(System.err);
    }
    return null;
}
 
开发者ID:1and1,项目名称:cli-skeleton,代码行数:32,代码来源:Params.java

示例6: doMain

import org.kohsuke.args4j.CmdLineParser; //导入方法依赖的package包/类
private void doMain(
        String[] args) {
    CmdLineParser parser = new CmdLineParser(this);
    try {
        parser.parseArgument(args);
        ensureResultXmlDirectory();

        generateDonutJsonFiles();

    }catch (CmdLineException c){
        System.err.println(c.getMessage());
        System.err.println("usage: Main [options ...]");
        parser.printUsage(System.err);
        System.exit(1);
    }catch (Exception e) {
        System.err.println(e.getMessage());
        System.exit(1);
    }
}
 
开发者ID:DonutReport,项目名称:donut-nunit-adapter,代码行数:20,代码来源:Main.java

示例7: start

import org.kohsuke.args4j.CmdLineParser; //导入方法依赖的package包/类
/**
 * Starts the application, running until it is closed
 *
 * @param args
 *            Arguments used to control application behavior
 */
public void start(String[] args) {
    CmdLineParser parser = new CmdLineParser(this);

    try {
        parser.parseArgument(args);
    } catch (CmdLineException e) {
        System.err.println();
        System.err.println(e.getMessage());
        parser.printUsage(System.err);
        return;
    }

    try (AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(
            CoronaIdeMainConfiguration.class)) {
        // Lookup the core configuration and initialize - this is the ONLY place the setters should be called
        ICoreConfiguration coreConfiguration = context.getBean(ICoreConfiguration.class);
        coreConfiguration.setLocations(Paths.get(applicationDirectory), Paths.get(workspaceDirectory));

        logger.info("Running in workspace {} from {}", workspaceDirectory, applicationDirectory);
        CoronaUIApplication.setSpringContext(context);
        Application.launch(CoronaUIApplication.class);
    }
}
 
开发者ID:StarChart-Labs,项目名称:corona-ide,代码行数:30,代码来源:Main.java

示例8: setup

import org.kohsuke.args4j.CmdLineParser; //导入方法依赖的package包/类
public void setup(String[] args) {
    CmdLineParser parser = new CmdLineParser(this);
    try {
        parser.parseArgument(args);
        if (showUsage) {
            System.err.println(versionString);
            System.err.println("Usage:");
            parser.printUsage(System.err);
            System.exit(0);
        }
    }
    catch (CmdLineException e) {
        System.err.println("ERROR: " + e.getMessage());
        System.err.println("Usage:");
        parser.printUsage(System.err);
        System.exit(1);
    }

    tools.INDEX_DIRECTORY_NAME = index_location;
}
 
开发者ID:isoboroff,项目名称:basekb-search,代码行数:21,代码来源:PredictType.java

示例9: doMain

import org.kohsuke.args4j.CmdLineParser; //导入方法依赖的package包/类
private void doMain(final String[] args) throws Exception {
    final ParserProperties properties = ParserProperties.defaults().withUsageWidth(80);
    final CmdLineParser parser = new CmdLineParser(this, properties);
    try {
        parser.parseArgument(args);
        if (_url == null) {
            throw new CmdLineException(parser, "URL to camera stream required.", null);
        }
        // http://1.0.0.6:8085/axis-cgi/jpg/image.cgi?resolution=640x480
        Camera axis = new Camera("Axis 2100 Network Camera", _url, "", "", Constants.REFRESH_RATE );

        CameraFrame frame = new CameraFrame( axis );
        frame.setVisible(true);
        frame.run();
    } catch (Exception e) {
        System.err.println("Usage:");
        parser.printUsage(System.err);
    }
}
 
开发者ID:markkolich,项目名称:axisviewer,代码行数:20,代码来源:AxisViewer.java

示例10: parseArguments

import org.kohsuke.args4j.CmdLineParser; //导入方法依赖的package包/类
private void parseArguments(String[] args) {
    CmdLineParser parser = new CmdLineParser(this);

    try {
        parser.parseArgument(args);
    } catch (CmdLineException e) {
        // if there's a problem in the command line,
        // you'll get this exception. this will report
        // an error message.
        System.err.println(e.getMessage());
        System.err.println("java -jar torfiles.jar [options...] arguments...");
        // print the list of available options
        parser.printUsage(System.err);
        System.err.println();
        System.exit(0);

        return;
    }
}
 
开发者ID:dessalines,项目名称:torfiles,代码行数:20,代码来源:WebService.java

示例11: doMain

import org.kohsuke.args4j.CmdLineParser; //导入方法依赖的package包/类
public void doMain(String... args) throws Exception {
	CmdLineParser cmdLineParser = new CmdLineParser(this);
	try {
		cmdLineParser.parseArgument(args);
	} catch (CmdLineException e) {
		System.err.println(e.getMessage());
		cmdLineParser.printUsage(System.err);
		return;
	}

	connectToMqttBroker();
	try {
		wait4ever();
	} finally {
		close();
	}

}
 
开发者ID:Ardulink,项目名称:Ardulink-2,代码行数:19,代码来源:MqttMain.java

示例12: printUsage

import org.kohsuke.args4j.CmdLineParser; //导入方法依赖的package包/类
private void printUsage(Object options) {
	CmdLineParser parser = new CmdLineParser(options);
	StringWriter sw = new StringWriter();
	sw.append(USAGE_PREFIX + "\n");
	sw.append(ALT_USAGE_PREFIX + " <source> <destination>\n");
	sw.append(ALT_USAGE_PREFIX + " [OPTION]... [<value>...]\n\n");
	sw.append("Options:");
	System.out.println(sw.toString());
	parser.setUsageWidth(100);
	parser.printUsage(System.out);
}
 
开发者ID:ghaseminya,项目名称:jbake-rtl-jalaali,代码行数:12,代码来源:Main.java

示例13: main

import org.kohsuke.args4j.CmdLineParser; //导入方法依赖的package包/类
public static void main(String[] args) throws IOException {
    TikaSpark tikaSpark = new TikaSpark();
    CmdLineParser parser = new CmdLineParser(tikaSpark);
    try {
        parser.parseArgument(args);
    } catch (CmdLineException e) {
        System.out.println(e.getMessage());
        parser.printUsage(System.out);
        return;
    }
    tikaSpark.run();
}
 
开发者ID:thammegowda,项目名称:tika-dl4j-spark-imgrec,代码行数:13,代码来源:TikaSpark.java

示例14: main

import org.kohsuke.args4j.CmdLineParser; //导入方法依赖的package包/类
public static void main(String[] args) throws CmdLineException, IOException {
    Local2SeqFile copier = new Local2SeqFile();
    CmdLineParser parser = new CmdLineParser(copier);
    try {
        parser.parseArgument(args);
    } catch (CmdLineException e) {
        System.out.println(e.getMessage());
        parser.printUsage(System.out);
        return;
    }
    copier.writeOutput(copier.readInput());
}
 
开发者ID:thammegowda,项目名称:tika-dl4j-spark-imgrec,代码行数:13,代码来源:Local2SeqFile.java

示例15: parseArguments

import org.kohsuke.args4j.CmdLineParser; //导入方法依赖的package包/类
private void parseArguments(String args[]) {
	CmdLineParser parser = new CmdLineParser(Rubus.this);
	parser.setUsageWidth(80);

	try {
		// parse the arguments.
		parser.parseArgument(args);

		// you can parse additional arguments if you want.
		// parser.parseArgument("more","args");

		// after parsing arguments, you should check
		// if enough arguments are given.
		if (arguments.isEmpty())
			throw new CmdLineException(parser, "No argument is provided");

	} catch (CmdLineException e) {

		System.err.println(e.getMessage());
		System.err.println("java Rubus [options...] arguments...");
		// print the list of available options
		parser.printUsage(System.err);
		System.err.println();

		// print option sample. This is useful some time
		System.err.println(" Example: java Rubus "
				+ parser.printExample(ExampleMode.ALL));

		return;
	}

	if (classPath != null && !classPath.isEmpty()) {
		ClassFinder.setClassPath(classPath);
	}

}
 
开发者ID:adnanmitf09,项目名称:Rubus,代码行数:37,代码来源:Rubus.java


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