-
Notifications
You must be signed in to change notification settings - Fork 86
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
HelpCalled and HasErrors preserve values when Parse(args) is called multiple times #96
Comments
Hi @agracio , Yes the internals of fclp remember some state from the last parse operation. It would be safer to recreate the fclp for each subsequent call at this stage until it can be changed to be state-less. |
I have considered this approach as a workaround, but my app has complex setup stage and recreating it can add overhead to command parsing times, is there a way reset state? I am already forced to use reflection for some features so adding one more internal call cannot hurt :) |
I think I solved the problem by re-initialising ParseEngine property before each call.
Is that enough to reset internal state? |
I think the Help property will need to be reset also |
So far my tests show that both HelpCalled and HasErrors are reset between multiple invocations of |
In an app that uses fluent-command-line-parser continuously
var result = Parse(args)
setsresult.HelpCalled
to true when help is called and stays true for all sub-sequential command calls.Edit:
result.HasErrors
behaves similarly by setting value to false when one successful command is called. All incorrect commands after that will still haveresult.HasErrors
set to false.Using version 1.5.0.20
The text was updated successfully, but these errors were encountered: