#5383: GetOpt parser too strict
---------------------------------+------------------------------------------
Reporter: mcandre | Owner:
Type: bug | Status: new
Priority: normal | Component: libraries/unix
Version: 7.0.4 | Keywords:
Testcase: | Blockedby:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
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.
}}}
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5383>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs