in connection with this Apache command line parser (Since it is completely out topic). Is there a way to strictly follow the short hand. Like -m and not -multi or for long name it should be --multiply and not --multi?
Since, as per post, commons-cli (Apache) evaluates both -m and -multi as the same. What i was thinking is that only -m or --multiply should be accepted.
I am using Apache's Commons CLI (commons-cli-1.3.1)
for the information of everyone, i got an idea on how to go about this problem. take a look at this. I got the idea on the answers.
Basically what you want to do is extend the
DefaultParserclass and overrideparse()method, add some of your logic in checkingargsand process toDefaultParser'sparse(viasuper.parse(...)). In that way you can retain the original behavior ofDefaultParserwhilst adding logics on top of it.Hope this helps someone.
Credits to this answer @Artur Skrzydło