As the command line code base grows larger, how do you encapsulate your commands, options and handlers? #2181
VigneshwarMoorthie
started this conversation in
General
Replies: 1 comment 2 replies
-
I've been deriving classes from System.CommandLine.Command and handling all the System.CommandLine specifics in those. The constructor of each such class calls SetHandler with a delegate that retrieves the argument and option values from System.CommandLine and passes them to an Invoke method in a "handler" class that does not depend on System.CommandLine at all. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My command line project is getting bigger and I am looking for an efficient way to separate out the commands and their handlers.
My plan was to create a class that inherits the command base class to create a command.
And then create another class which implements the command handler interface.
However I delcare the option in the command class and cannot retrieve it during the GetValueForOption method call in the command handler class?
Beta Was this translation helpful? Give feedback.
All reactions