31 lines
970 B
C++
31 lines
970 B
C++
// capmcp_cli: a thin test driver around the CAP and MCP classes. It stands in
|
|||
|
|
// for main.cpp (which the integrator owns) so the same argv can be run through
|
||
|
|
// tai.py and through the C++ classes and the outputs diffed.
|
||
|
|
//
|
||
|
|
// capmcp_cli --cap-manifest
|
||
|
|
// capmcp_cli --cap COMMAND ...
|
||
|
|
#include <cstdio>
|
||
|
|
#include <string>
|
||
|
|
#include <vector>
|
||
|
|
|
||
|
|
#include "cap_agent_manifest.h"
|
||
|
|
#include "cap_cli.h"
|
||
|
|
|
||
|
|
int main(int argc, char** argv) {
|
||
|
|
std::vector<std::string> args(argv + 1, argv + argc);
|
||
|
|
if (args.empty()) {
|
||
|
|
std::fputs("usage: capmcp_cli --cap-manifest | --cap COMMAND ...\n", stderr);
|
||
|
|
return 2;
|
||
|
|
}
|
||
|
|
if (args[0] == "--cap-manifest") {
|
||
|
|
// print(TAI_CAP_MANIFEST)
|
||
|
|
std::fputs((detz::cap::CapAgentManifest::TAI_CAP_MANIFEST() + "\n").c_str(), stdout);
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
if (args[0] == "--cap") {
|
||
|
|
return detz::cap::CapCli::capCliMain(std::vector<std::string>(args.begin() + 1, args.end()));
|
||
|
|
}
|
||
|
|
std::fputs("unknown mode\n", stderr);
|
||
|
|
return 2;
|
||
|
|
}
|