本文整理匯總了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();
}
}