-
Notifications
You must be signed in to change notification settings - Fork 120
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
Incorrect PrintHelpMessage return code #187
Comments
Every command line tool I looked at exits with status code 0 when they print their help message, so I think the current behavior is correct, and this is a bug in the documentation. |
@ajalt I agree, but you always tried with "--help", which of course should return 0. But if you're trying:
Even if output is similar to --help, this is still an error. That's what I was talking about, and that's why it's not obvious for me that show usage output should always finish without error. |
I see. That's different than the I'll add an |
Facing a similar issue than #41 I tried to display the help message + return an error code, as it's specified in PrintHelpMessage javadoc:
clikt/clikt/src/commonMain/kotlin/com/github/ajalt/clikt/core/exceptions.kt
Line 25 in 8078c48
Sadly the current behavior is returning the return code 0:
clikt/clikt/src/commonMain/kotlin/com/github/ajalt/clikt/core/CliktCommand.kt
Line 278 in b9c1891
Considering help message is the expected output when using -h or --help which is already implemented by clikt, user usage of PrintHelpMessage would probably always means that help message is the consequence of an error.
If you agree with previous sentence, I would encourage enforcing javadoc behavior by fixing the code but still provide a way to show help message without failing (like Abort logic?).
In any case, thanks for your this nice project, always useful when trying to create Kotlin CLI 👍
The text was updated successfully, but these errors were encountered: