I am creating a CLI based application using Apache Commons CLI. I want my program to run normally even if the user has provided some extra arguments. In this case the program should ignore the extra argument. For example, my program is designed to accept 6 arguments and I provided 7th argument. In this case, the program will print the usages and the arguments will not be parsed. I want my application to parse all the 6 arguments and ignore the 7th argument. It is possible with Apache Commons CLI?
Asked
Active
Viewed 315 times
0

Emmanuel Bourg
- 9,601
- 3
- 48
- 76

Ashwani Kumar
- 834
- 3
- 16
- 30
-
1Possible duplicate of http://stackoverflow.com/questions/6049470/can-apache-commons-cli-options-parser-ignore-unknown-command-line-options?rq=1. – Duncan Jones Aug 23 '12 at 09:08
-
I assume from the other question that there is no direct method in the API to achieve your goal. So the solution presented is the best course of action. It looks fine to me. – Duncan Jones Aug 23 '12 at 09:26