java - Command line options style - POSIX or what? - Programmers Stack Exchange
EDIT: It's been pointed out that this style is a GNU-ism, and that non-GNU based Unixes tend to use a single-dash syntax (in particular, OS X and BSD variants).
Despite it's GNU-ism status, many newly written Unix-style programs use this style:
--long-option
for long option names,-s
for short (one-character) options,-abc
for multiple short options without arguments (one character per option).- Options with arguments:
--long arg
or--long=arg
for long options,-s arg
,-sarg
or (optionally)-s=arg
for short options. This can be combined with other short options, as long as only the last one has an argument.
- The same "semantic" option can have several aliases, most commonly a short (quicker to type) one and a long (easier to remember) one.
Anybody that has used a Linux shell for any amount of time should be familiar with this style1, so it has the principle of least surprise on its side. Allowing grouping of multiple short options without being ambiguous with long options is also nice.
Read full article from java - Command line options style - POSIX or what? - Programmers Stack Exchange
No comments:
Post a Comment