请问在互动直播demo 登录后报错Uncaught TypeError: qavSdk.Login is not a function(…) 怎么解决呢?
看看最近的JCommander。
我创造了它。我很高兴收到问题或功能要求。
检查这些:
http://commons.apache.org/cli/
http://www.martiansoftware.com/jsap/
或者滚动你自己的:
http://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html
例如,这是你如何使用commons-cli解析2个字符串参数:
import org.apache.commons.cli.*;
public class Main {
public static void main(String[] args) throws Exception {
Options options = new Options();
Option input = new Option("i", "input", true, "input file path");
input.setRequired(true);
options.addOption(input);
Option output = new Option("o", "output", true, "output file");
output.setRequired(true);
options.addOption(output);
CommandLineParser parser = new DefaultParser();
HelpFormatter formatter = new HelpFormatter();
CommandLine cmd;
try {
cmd = parser.parse(options, args);
} catch (ParseException e) {
System.out.println(e.getMessage());
formatter.printHelp("utility-name", options);
System.exit(1);
return;
}
String inputFilePath = cmd.getOptionValue("input");
String outputFilePath = cmd.getOptionValue("output");
System.out.println(inputFilePath);
System.out.println(outputFilePath);
}
}
来自命令行的用法:
$> java -jar target/my-utility.jar -i asd
Missing required option: o
usage: utility-name
-i,--input <arg> input file path
-o,--output <arg> output file