docopt / docopt.hs

A command-line interface description language and parser that will make you smile
http://docopt.org/
MIT License
119 stars 24 forks source link

Make usage-/help-string behavior consistent with original `docopt` #50

Closed jpdoyle closed 7 months ago

jpdoyle commented 3 years ago

Fixes https://github.com/docopt/docopt.hs/issues/32.

This makes 3 main changes to this library's behavior:

1) pUsagePatterns (and thus pDocopt) parses out the "Usage:" section of the helpstring as a string and returns that. The way I'm parsing it feels really hacky but I wasn't sure a better way to achieve it. 2) exitWithUsage and exitWithUsaegMessage now print that "short usage string" rather than the whole helpstring. exitWithHelpstring has been added, which prints the whole helpstring. 3) parseArgsOrExit automatically exits printing the helpstring if longOption "help" is present, to be more consistent with the original docopt behavior. I'm not sure this is the correct place in the library to put it, but it creates the intended behavior.

DigitalBrains1 commented 7 months ago

Oh we moved the default branch from master to main and if you then delete the old branch it closes PR's that were opened against that branch. I have no opinion (yet) on this PR; I'd like to keep it open but that is impossible. I'll make a note to look at this later.