cli

原创
2020/08/09 14:42
阅读数 79
    public static void main(String[] args) {

        Options options = new Options();
        CommandLineParser commandLineParser = new DefaultParser();
        options.addOption("h", "usage help");
        options.addOption(Option.builder("d").longOpt("decompress").type(String.class).desc("Decompress the JFR file").build());
        options.addOption(Option.builder("f").longOpt("jfrdump").argName("jfr file path").hasArg(true).desc("Java Flight Recorder Dump").required(true).build());
        options.addOption(Option.builder("e").longOpt("event").argName("Type of event used to generate the flamegraph").hasArg(true).required(false).desc("[cpu, allocation-tlab, allocation-outside-tlab, exceptions, monitor-blocked, io]").build());
        CommandLine commandLine;
        try {
            commandLine = commandLineParser.parse(options, args);
        } catch (ParseException e) {
            HelpFormatter helpFormatter = new HelpFormatter();
            helpFormatter.printHelp( "ant", options );
            System.exit(0);
        }

    }
展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部