Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from

Conversation

jpdoyle
Copy link

@jpdoyle jpdoyle commented Sep 27, 2021

Fixes #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.

Fixes docopt#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.
@FullstackGJJ FullstackGJJ self-requested a review September 29, 2021 15:18
@DigitalBrains1 DigitalBrains1 deleted the branch docopt:master February 24, 2024 16:42
@DigitalBrains1
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prints whole usage string on incorrect arguments
3 participants