-
-
Notifications
You must be signed in to change notification settings - Fork 61
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
Help Command closes Program - undesirable in web chat app parsing #29
Comments
Hi @zanven42 I totally see where you are coming from. I have also considered that perhaps having However I am reluctant to change it now as this may introduce breaking changes. And I see quite a few people using this in their projects already. I think we have 3 options here:
I personally like 3rd option better since it will satisfy your issue and also keep things as they currently are for others. |
yeah, i think option 3 would be best to continue on. While i was hacking away last night on a discord bot i forked the repository and what i had changed was that the i'll see what i can come up with that is backwards compatible because i definitely like the Help object but just want the text output for me to consume and no os.exit. what i was thinking is when |
That would be great, if the |
Agree, but I would like to keep it backward compatible to avoid unexpected surprises to those who always I think good start at this issue would be to move default help message formatting into its own exported method, and use that method as default option for help message. Which then can be overwritten with any other method. After that can see how can make that I would appreciate a PR for this since I am rather swamped with work at the moment. |
Designed to begin addressing issue akamensky#29 HelpFunc added as field for Parsers and Commands Parser HelpFunc defaults to Usage unless overwritten Command HelpFunc defaults to first non nil parent HelpFunc Design choice to enable backwards compatibility required exposing Command and Arg fields with Getter functions. Does not resolve: exiting program on help invocation overwrritting/disabling -h | --help argument strings enabling other argument strings to invoke help
Designed to begin addressing issue akamensky#29 HelpFunc added as field for Parsers and Commands Parser HelpFunc defaults to Usage unless overwritten Command HelpFunc defaults to first non nil parent HelpFunc Design choice to enable backwards compatibility required exposing Command and arg fields with Getter functions and an interface. Does not resolve: exiting program on help invocation overwrritting/disabling -h | --help argument strings enabling other argument strings to invoke help
Adds a Settings struct for creating parsers/commands with NewParserWithSettings or NewCommandWithSettings. Settings HelpDisabled - defaults false, set true to not generate a help argument for parser/command HelpSname - short name for the parser/command help argument. Can be left empty HelpLname - long name for the parser/command help argument. Leaving empty forces use of -h/--help when HelpDisabled is false NoExitOnHelp - defaults false, set true to not exit on help argument being parsed Should resolve all outstanding help argument issues.
Commit 0f6d107: |
Fixed merge conflict error due to check function return type change confusion.
@densestvoid has this been resolved? (i haven't had a chance to test functionality just yet, but since you helped to implement this I presume you tested and possibly are using it) |
* Finishes addressing issue #29 Adds a Settings struct for creating parsers/commands with NewParserWithSettings or NewCommandWithSettings. Settings HelpDisabled - defaults false, set true to not generate a help argument for parser/command HelpSname - short name for the parser/command help argument. Can be left empty HelpLname - long name for the parser/command help argument. Leaving empty forces use of -h/--help when HelpDisabled is false NoExitOnHelp - defaults false, set true to not exit on help argument being parsed Should resolve all outstanding help argument issues. * Finishing Issue #29 Fixed merge conflict error due to check function return type change confusion. * Updated Settings Object to multiple function calls Added functions: DisableHelp SetHelp ExitOnHelp Added Command.exitOnHelp Added more tests to increase code coverage * Updated no help example
@densestvoid the #50 is merged, feel free to close this issue if it is resolved in that PR. <3 |
@akamensky I do not have the access to close issues. Unless @zanven42 feels the recent help features do not fully address the issue, I would consider it closed. |
Closing, please re-open if not resolved. |
Hi i am trying to build a discord chat bot, and leveraging this package has been awesome for that, however when the parser is created a non overridable help argument is added which os.Exit(0) when triggered which is meaning users chatting the bot can make it close. I know this is probably a unexpected use case, i am willing to fork the project and workout a solution if you would like to give my guidance on how the end state should look.
The text was updated successfully, but these errors were encountered: