Files
tai/taicpp/main.cpp
T

24 lines
728 B
C++
Raw Normal View History

// detz entry point: parse the command line and hand it to the glue (docs/glue.md).
#include <unistd.h>
#include <climits>
#include <string>
#include "cli/cli.h"
#include "glue/glue_app.h"
#include "version.hpp"
namespace {
std::string running_binary(const char* argv0) {
char buf[PATH_MAX];
ssize_t n = readlink("/proc/self/exe", buf, sizeof buf - 1);
if (n > 0) return std::string(buf, static_cast<size_t>(n));
return argv0 ? argv0 : "detz";
}
} // namespace
int main(int argc, char** argv) {
detz::cli::Parser parser;
detz::cli::Options options = parser.parseOpts(argc, argv);
detz::glue::GlueApp app(options, std::string(detz::kVersion), running_binary(argc > 0 ? argv[0] : nullptr));
return app.run();
}