本文整理汇总了Java中net.sourceforge.argparse4j.inf.ArgumentParser.printHelp方法的典型用法代码示例。如果您正苦于以下问题:Java ArgumentParser.printHelp方法的具体用法?Java ArgumentParser.printHelp怎么用?Java ArgumentParser.printHelp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.sourceforge.argparse4j.inf.ArgumentParser
的用法示例。
在下文中一共展示了ArgumentParser.printHelp方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import net.sourceforge.argparse4j.inf.ArgumentParser; //导入方法依赖的package包/类
public static void main(String[] args) {
ArgumentParser parser = argParser();
if (args.length == 0) {
parser.printHelp();
Exit.exit(0);
}
try {
final VerifiableConsumer consumer = createFromArgs(parser, args);
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
consumer.close();
}
});
consumer.run();
} catch (ArgumentParserException e) {
parser.handleError(e);
Exit.exit(1);
}
}
示例2: main
import net.sourceforge.argparse4j.inf.ArgumentParser; //导入方法依赖的package包/类
public static void main(String[] args) {
ArgumentParser parser = ArgumentParsers.newArgumentParser("AdlChecker")
.defaultHelp(true)
.description("Checks the syntax of ADL files");
parser.addArgument("file").nargs("*")
.help("File to calculate checksum");
Namespace ns = null;
try {
ns = parser.parseArgs(args);
} catch (ArgumentParserException e) {
parser.handleError(e);
System.exit(1);
}
if(ns.getList("file").isEmpty()) {
parser.printUsage();
parser.printHelp();
}
validateArchetypes(ns.getList("file"));
}
示例3: main
import net.sourceforge.argparse4j.inf.ArgumentParser; //导入方法依赖的package包/类
public static void main(
String[] args)
throws IOException,
InterruptedException,
NoSuchMethodException,
IllegalAccessException,
InvocationTargetException,
ParseException,
WebServerException,
InstantiationException,
ClassNotFoundException, SurveyException
{
ArgumentParser argumentParser = makeArgParser();
Namespace ns;
try {
ns = argumentParser.parseArgs(args);
init(ns.getString("backend"), ns.getString("properties"), ns.getString("config"));
if (backendType.equals(KnownBackendType.LOCALHOST))
Server.startServe();
AbstractLibrary.dashboardDump(ns);
boolean runDashboard = Boolean.parseBoolean((String) ns.get("dashboard"));
if (backendType.equals(KnownBackendType.NONE) && runDashboard)
runDashboard(Record.deserializeLatestRecord((String) ns.get("record")));
else
runAll(ns.getString("survey"), ns.getString("separator"), ns);
if (backendType.equals(KnownBackendType.LOCALHOST))
Server.endServe();
String msg = String.format("Shutting down. Execute this program with args %s to repeat.", Arrays.toString(args));
LOGGER.info(msg);
} catch (ArgumentParserException e) {
System.err.println("FAILURE: "+e.getMessage());
LOGGER.fatal(e);
argumentParser.printHelp();
}
}