java命令行解析库,用于解析命令行参数的Java库?

I write a little command-line-application in Java. This application should work with a mix of parameters and commands, similar to svn.

Examples

app url command1

app url command2 --parameter2 -x

app url command1 --param-with-argument argument

app --parameter url command1

app --no-url command2

app --help

Wanted

Exists an easy-to-use library for Java

Supports parsing of such command-lines

(Bonus) Automatically creates an appropriate help

解决方案

I'm a fan of Commons CLI.

You can set it to understand commands, flags (with short and long names), whether or not certain commands/switches are required, or if they have default values. It even has functionality to print out a useful --help type message.

The Usage Scenarios page has some good examples of how it can be used.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值