importcom.beust.jcommander.JCommander;importcom.beust.jcommander.Parameter;publicclassCalc{@Parameter(names={"--numberA","-a"},description="数字A")inta;@Parameter(names={"--numberB","-b"},description="数字B")intb;@Parameter(names={"--model","-m"},description="运算符,支持 + - x /")Stringmodel;@Parameter(names="--help",help=true)booleanhelp;publicstaticvoidmain(String...args){Calcmain=newCalc();JCommanderjCommander=JCommander.newBuilder().addObject(main).build();jCommander.parse(args);if(main.help){jCommander.usage();return;}main.run();}publicvoidrun(){intresult;switch(model){case"+":result=a+b;break;case"-":result=a-b;break;case"x":result=a*b;break;case"/":result=a/b;break;default:System.out.println("不支持的运算符");return;}System.out.println(result);}}