本文整理汇总了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());
}
示例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();
}
示例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();
}
示例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 + "'.");
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例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;
}
}
示例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();
}
}
示例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);
}
示例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();
}
示例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());
}
示例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);
}
}