當前位置: 首頁>>代碼示例>>Java>>正文


Java CmdLineException.printStackTrace方法代碼示例

本文整理匯總了Java中org.kohsuke.args4j.CmdLineException.printStackTrace方法的典型用法代碼示例。如果您正苦於以下問題:Java CmdLineException.printStackTrace方法的具體用法?Java CmdLineException.printStackTrace怎麽用?Java CmdLineException.printStackTrace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.kohsuke.args4j.CmdLineException的用法示例。


在下文中一共展示了CmdLineException.printStackTrace方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import org.kohsuke.args4j.CmdLineException; //導入方法依賴的package包/類
public static void main(String[] args) throws ClassNotFoundException {

        // https://martin-thoma.com/how-to-parse-command-line-arguments-in-java/
        EBoardRender.Config config = new EBoardRender.Config();

        CmdLineParser parser = new CmdLineParser(  config );
        try {
            parser.parseArgument(args);
        } catch (CmdLineException e) {
            e.printStackTrace();
        }

        Configuration conf = Configuration.getInstance(config.getConfig());
            String command = conf.getCommand().trim().toUpperCase();
            CommandHandler commandHandler = conf.getCommandHandlerFactory().getCommandHandler(command);
            commandHandler.execute(conf);
    }
 
開發者ID:eamonfoy,項目名稱:trello-to-markdown,代碼行數:18,代碼來源:EBoardRender.java

示例2: parseArguments

import org.kohsuke.args4j.CmdLineException; //導入方法依賴的package包/類
/**
 * This method will use args4j to parse the provided arguments and
 * will store information about the actor temporary.
 *
 * @param messageEvent The MessageEvent triggering this command.
 * @return True, if parsing was successful. False, if the parsing failed because of missing required arguments, ...
 */
public boolean parseArguments(ChannelMessageEvent messageEvent) {
	// Save Actor
	setActor(messageEvent.getUser());

	// Parse Arguments
	CmdLineParser parser = new CmdLineParser(this);

	// Disable parsing @ as files (is used to mention users)
	parser.getProperties().withAtSyntax(false);

	try {
		// Parse the arguments.
		parser.parseArgument(messageEvent.getMessage().split(" "));
		setParsedContent(getCommandContent(messageEvent));

		// Remove the Command from the parsedArguments
		getParsedArguments().remove(0);

	} catch (CmdLineException ex) {
		ex.printStackTrace();

		// Invalid Command Usage - Trigger Help?
		return false;
	}

	return true;
}
 
開發者ID:twitch4j,項目名稱:twitch4j,代碼行數:35,代碼來源:Command.java

示例3: main

import org.kohsuke.args4j.CmdLineException; //導入方法依賴的package包/類
public static void main(String ... args) {
    VennDrawCLI vennDrawCLI = new VennDrawCLI();
    CmdLineParser parser = new CmdLineParser(vennDrawCLI);

    boolean showHelp = false;

    if (args.length == 0) showHelp = true;

    if (args.length == 1)
        if (args[0].equals("-h") || args[0].equals("--help") || args[0].equals("-v") || args[0].equals("--version") || args[0].equals("-?"))
            showHelp = true;

    if (!showHelp) {
        try {
            parser.parseArgument(args);
            vennDrawCLI.run();
        } catch (CmdLineException e) {
            e.printStackTrace();
            showHelp = true;
        }
    }

    if (showHelp) {
        System.out.println("VennDraw " + VersionResolver.getVersion());
        System.out.println("Git Commit: " + VersionResolver.getGitCommit());
        System.out.println("Build Date: " + VersionResolver.getBuildDate());
        System.out.println("\n");
        System.out.print("venndraw ");
        parser.printSingleLineUsage(System.out);
        System.out.println();
        System.out.println();
        parser.printUsage(System.out);
    }
}
 
開發者ID:informationsea,項目名稱:VennDraw,代碼行數:35,代碼來源:VennDrawCLI.java

示例4: parseArgs

import org.kohsuke.args4j.CmdLineException; //導入方法依賴的package包/類
public static CmdLineParser parseArgs(String[] args, Object t) {
    CmdLineParser parser = new CmdLineParser(t);
    try {
        parser.parseArgument(args);
    } catch (CmdLineException e) {
        e.printStackTrace();
        System.err.println(e.getMessage());
        parser.printUsage(System.err);
        System.err.println();
        System.exit(1);
    }
    return parser;
}
 
開發者ID:shunfei,項目名稱:indexr,代碼行數:14,代碼來源:RuntimeUtil.java

示例5: main

import org.kohsuke.args4j.CmdLineException; //導入方法依賴的package包/類
public static void main(String[] args) throws Exception {
  ServerConfiguration configuration = new ServerConfiguration();
  CmdLineParser parser = new CmdLineParser(configuration);
  try {
    parser.parseArgument(args);
  } catch (CmdLineException e) {
    e.printStackTrace(System.err);
    printUsage(parser);
    return;
  }
  runServer(configuration);
}
 
開發者ID:apache,項目名稱:beam,代碼行數:13,代碼來源:ReferenceRunnerJobServer.java


注:本文中的org.kohsuke.args4j.CmdLineException.printStackTrace方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。