Having C++ console utility.
The code inside parses the command line input and depending on input invokes particular function.
I’ve got a big ugly parsing routine that calls global functions.
I dislike this code and want to organize this code by design pattern application.
The flow is as following:
- process command line args;
- if error occurs then report about it and exit, otherwise continue;
- call specific routine depending on what parameters were specified;
What pattern will you advise for this case?
Thank you.
A common design pattern used for something like this is the Command pattern.