I am currently working on a CLI utility which I feel can be improved a lot by adding a framework.
Basically the utility revolves around lots of command line syntax AND parsing the output. Currently the code is scattered all around with lots of individual inhouse run() and readFromRunOutput() calls with hardcoded CLI arguments.
For example:
op=run("command -args");
while(readFromRunOutPUr(op))
{
// Process and take result from output
if(op=="result-one")
dothis();
else if(op=="result-two")
dothat();
}
I would like to create a generic framework out of this wherein the the following are fed in from outside the code through a XML file. 1) Test Name 2) Command Line invocation 3) Required Output for Success
So assumming a simple XML invocation...
<Test name=FirstTest>
<CLI="command -args">
<Success Output= "value" >
</Success>
</CLI>
</Test>
Yes. There are some few chinks to worry about in the above example but I think I have given the gist of it. Basically I would like to move all the different CLI invocations to outside the code and then feed them in(with the criteria for success and failure). For lot of other reasons I cannot go for any scripting languages like perl or python and have to maintain the product in C/C++.
From what I gather the requirements are
Defined XML syntax
Parser for the above XML spec to memory
Get CLI -----> and invoke
Read Output and compare with the fed in values
(Preferably cross platform support)
An implementation like this would not only standardize on all the different individual function calls but also make it easy to extend without any code changes.
Now my question is , are there any readymade free libraries(for C++) available which already provide similar or basic template framework on which I can extend. Preferably first hand experience. Any other guidance ?