Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there any naming conventions for command line arguments?

Am reviewing a command line driven Java application with command line switches in lower camel case like this:

myapp aSwitch anotherSwitch aThirdSwitch

Am thinking all lower case and leading hyphens may be preferable:

myapp -aswitch -anotherswitch -athirdswitch

...or perhaps:

myapp -a-switch -another-switch -a-third-switch

But struggling to come up with a compelling justification. Would like to follow current conventions and be cross-platform compatible at least for Windows/Linux.

Grateful for advice on what is the most commonly used convention out of these three - and any good reasons for this.

like image 305
Steve Chambers Avatar asked Jun 15 '15 08:06

Steve Chambers


1 Answers

Apache Commons CLI has a description of the commonly used convention. it is also a good parser for such use cases

like image 143
Sharon Ben Asher Avatar answered Sep 20 '22 05:09

Sharon Ben Asher