-
Notifications
You must be signed in to change notification settings - Fork 418
Description
I'm trying to work out the "right" way to use this library, and a very simple use case that puzzles me is "detect that --help was invoked, so we can terminate the application after handling arguments", and it is not really clear to me how that should be done.
My first thought was that I should attach an Action to the Option, and have that action return non-zero, which would propagate out to the top-level Invoke call. Then I'd check the return value there, and if non-zero, terminate the application.
But if an Option's action returns non-zero the return value just seems to be discarded.
I also noted that none of the documentation seems to use actions on Option objects, and that while actions on Command objects can just be lambdas, the ones on Option have to be a class derived from CommandLineAction. It kind of feels like Option actions are a bit half-baked? Are they not supposed to be used?
So two questions:
- what is the point of setting actions on an
Optionobject? (And what is the point of being able to return an integer from those actions?) - what is the intended way to detect that --help was invoked so you can terminate the application?