JCommander 是一个非常小的Java 类库,用来解析命令行参数。
示例代码:
import com.beust.jcommander.Parameter; public class JCommanderTest { @Parameter public List parameters = Lists.newArrayList(); @Parameter(names = { "-log", "-verbose" }, description = "Level of verbosity") public Integer verbose = 1; @Parameter(names = "-groups", description = "Comma-separated list of group names to be run") public String groups; @Parameter(names = "-debug", description = "Debug mode") public boolean debug = false; }