-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Setting or function to prohibit process termination #256
Comments
This is possible, we'll have to look at the best naming and such in order to implement. The work-around is simple, but somewhat hacky at the moment. Simply define your own The same applies to subcommands with the name of Hope this answers your question. We'll update this issue as decisions are made and discussed about adding a "safer" safe 😄 |
Thanks for looking into this. That workaround will probably be enough for the moment. |
One other thing to note (although I haven't tested it) is also setting the |
How about having an option for default help or version? |
Or the opposite of having an option to disable default help and version? On Thu, Sep 17, 2015, 8:37 PM SungRim Huh notifications@github.com wrote:
|
That works too. I took a brief look at the |
@sru Also a brief look at the same file. Grep style. Instances of 'exit' in src/app.rs
Source of help and version
The help and version do not appear to be added to the App. Instead, just assumed in the runtime. Spelling mistakes detected at 505, 659. 😉 Also. Wow this file is large 👻 |
@james-darkfox Wow. I didn't think of using @kbknapp I have several other ideas as well concerning the general process termination (not the help and version specific). Just like the title of this issue, we could have a setting to prohibit process termination and wrap every I am a bit wary with the
So, another idea is that let the user handle the error entirely. In this case, we could delegate the error message to |
@sru I also vote towards |
I also vote for ClapError. I do not need to disable the help and version flags and returning a ClapError instead of Process-Termination is just what I need to handle that special case. |
We could move it to Thoughts? |
@kbknapp Is there an example in |
|
@kbknapp I meant to say how does clap determine if the error should go to stderr or stdout. Or is it like user chooses where the error output should go? |
@sru One fatal context I've noticed is |
@james-darkfox yep that's the intention I had. |
Thanks. This is exactly the behavior I expected at first, when using the safe-function. Hopefully this will be also more intuitive and useful to other users as well. Looking forward to the actual merge! |
I would like to use clap's easy syntax for different stages in my program then just command line argument parsing. E.g. to parse remote commands with arguments read from sockets. I can already utilize clap using get_matches_from. But even get_matches_from_safe terminates my program when --help or --version gets passed to. I would like to have either an even safer _safe method or an app-setting, that completely blocks any terminate inside the clap crate and some kind of indication, if parsing did succeed or it should have terminated.
Would that be possible?
Best regards,
Drakulix
The text was updated successfully, but these errors were encountered: