The Wayback Machine - https://web.archive.org/web/20200919013007/https://github.com/xenomachina/kotlin-argparser/pull/52
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

Update README.md #52

Open
wants to merge 1 commit into
base: master
from
Open

Conversation

@InsanusMokrassar
Copy link

InsanusMokrassar commented Mar 23, 2018

Add helpfull description for help message showing

Add helpfull description for help message showing
@codecov-io
Copy link

codecov-io commented Mar 23, 2018

Codecov Report

Merging #52 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #52   +/-   ##
=========================================
  Coverage     82.97%   82.97%           
  Complexity      138      138           
=========================================
  Files            11       11           
  Lines           417      417           
  Branches         82       82           
=========================================
  Hits            346      346           
  Misses           36       36           
  Partials         35       35

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9244053...a1b8fcb. Read the comment docs.

e.printAndExit()
}
```

This comment has been minimized.

@xenomachina

xenomachina Mar 23, 2018 Owner

Thanks for pointing that this was not clear enough!

The supported way to do this is actually to use mainBody, or at least to catch all SystemExitExceptions, as mentioned in the Error Handling section.

Perhaps just change this to say something like:

For help messages to correctly display you must properly handle any SystemExitException that is thrown as described in Error Handling.

You could even link to that section.

This comment has been minimized.

@InsanusMokrassar

InsanusMokrassar Apr 28, 2018 Author

Thank you for your response.

I think, that catch only awaited exception (such as ShowHelpException) is best way. In this case we need to catch only exception which will say to show help and catching ShowHelpException will give us all what we need.

This comment has been minimized.

@xenomachina

xenomachina Apr 28, 2018 Owner

I don't think I understand your point.

ShowHelpException is a subclass of SystemExitException. In most cases you probably want to handle all SystemExitExceptions, not just ShowHelpException. They all contain a message for the user, as well as an exit code. The exit code for ShowHelpException just happens to be 0.

This comment has been minimized.

@InsanusMokrassar

InsanusMokrassar May 3, 2018 Author

I mean that any other exception must be handled by other way. In this case we need to catch just ShowHelpException and it is will be ok for show help message

This comment has been minimized.

@xenomachina

xenomachina May 3, 2018 Owner

But you don't need to handle other SystemExitExceptions in a different way. All SystemExitExceptions can be handled by calling their printAndExit() method or by using mainBody (which will call printAndExit for you). It would be pretty unusual to need to catch only ShowHelpException.

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

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.