On 4/24/06, pb [email protected] wrote:
"The Gnu and the Unix option types can be mixed on the same commandline.
CommandLine is established code. Where did I wander off the path?
Nope. You understood correctly. I am afraid that you have found the soft
underbelly of CommandLine. That behavior used to be supported, but was
removed.
So, in short, the documentation has lied to you.
The problem comes about from trying to support too many different option
types,
so at the time, they were removed so we could make a timely release. So
far,
you are
the first that wanted to mix the two. There shouldn’t be a problem
adding
this feature, but we would need to add a check to test for legal
combinations.
If you want to provide a patch I am more that willing to add it in.
Or, you can wait on me. Not sure when I can get around to this,
but I think it should be done.
Let me provide a little history of the problem.
The three option styles are Gnu, XTools and Posix.
Other than syntax, there is also functional features of each.
Gnu and XTools can always be abbreviated. That is, the option
“–fred” can be represented as “–fre”, “–fr”, or “–f”, if any of
those
are unique. The same holds for XTools, “-fred” can be represented
as “-fre”, “-fr” or “-f”. This feature is always on and cannot be turned
off.
The functional feature of Posix is that the options “-a” and “-b” can be
written as “-ab” or as “-ba”. Supporting this with XTools could get
confusing,
so we have opted not to support this.
If the Posix functional feature of combining options is turned off, then
all three may be combined in the same set of options. CommandLine
prefers this since it doesn’t want to limit how you define options.
But, if we turn the Posix combining feature on, we have the following
possible combinations:
gnu, xtools - ok
gnu, posix - ok
posix, xtools - illegal
gnu, posix, xtools - illegal
To implement this change, application.rb and optionparser.rb will need
to be
modified (and possibly option.rb).
So, please help me out here on the interface.
Most people will use gnu style options with the posix style short
options.
If the options list only contains gnu and posix style options, should
posix
be on by default? How should posix be turned on and off?