CmdLine example program Should be installed as ui-utilcpp-cmdline along with the library.
#include "config.h"
#include <iostream>
#include <fstream>
#include <vector>
{
public:
TestCmd()
:
Cmd(
"test",
"Test command")
{
addArg(
"testarg",
"Mandatory test argument documentation");
addOptArg(
"testoptarg",
"Optional test argument documentation");
}
private:
int runCmd()
{
cl_->os() << "Test command running" << std::endl;
cl_->os() <<
"Arg(1) == " <<
getArg(1) << std::endl;
cl_->os() <<
"Arg(2) == " <<
getArg(2) << std::endl;
return(0);
}
};
{
public:
TestCmdLine(std::istream * is, std::ostream * os)
:CmdLine(is, os, &std::cerr, "Test Command Line", "\nTest Prompt# ")
{
setVar("NATIVE_MOJO", "YES");
add(new TestCmd());
}
~TestCmdLine()
{}
};
int main()
{
return(TestCmdLine(0, &std::cout).run());
}