GetOpt parser too strict
For !GetOpt, some CLI arguments must be right next to the flag, and some do not.
Relevant scripts: http://www.delicious.com/mcandre/getoptfu
The command specified two bananas, but the 2 isn't parsed correctly.
$ ./groceries.hs -p -j -b 2
FoodCo welcomes you, Mr. Derp.
YOU BOUGHT PEANUT BUTTER!!!
YOU BOUGHT JELLY!!!
YOU BOUGHT 1 BANANAS!!!
Mr. Derp bought 3 items.
Thank you, come again soon.
When 2 is specified right after -b
, it is parsed correctly. This is against most CLI formats. Most CLI users expect a space between flags and values.
$ ./groceries.hs -p -j -b2
FoodCo welcomes you, Mr. Derp.
YOU BOUGHT PEANUT BUTTER!!!
YOU BOUGHT JELLY!!!
YOU BOUGHT 2 BANANAS!!!
Mr. Derp bought 4 items.
Thank you, come again soon.
Furthermore, !GetOpt is inconsistent: it does not need a space between flags and string values--it parses them either way.
$ ./groceries.hs -s Moops
Moops welcomes you, Mr. Derp.
Mr. Derp bought 0 items.
Thank you, come again soon.
$ ./groceries.hs -sMoops
Moops welcomes you, Mr. Derp.
Mr. Derp bought 0 items.
Thank you, come again soon.
Trac metadata
Trac field | Value |
---|---|
Version | 7.0.4 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | libraries/unix |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |