blob: 5fa05faab1470e984755c161b4f092ed6e3da635 [file] [log] [blame]
Andrew Geissleree3a2c82019-07-30 15:16:20 -05001#include <CLI/CLI.hpp>
2#include <iostream>
3#include <phosphor-logging/log.hpp>
Andrew Geissler891213b2019-07-30 14:08:17 -05004#include <sdbusplus/bus.hpp>
5#include <sdeventplus/event.hpp>
Andrew Geissleree3a2c82019-07-30 15:16:20 -05006#include <vector>
7
8using phosphor::logging::level;
9using phosphor::logging::log;
10
11void print_usage(void)
12{
13 std::cout << "[-f <file1> -f <file2> ...] : Full path to json file(s) with "
14 "target/error mappings"
15 << std::endl;
16 return;
17}
Andrew Geissler891213b2019-07-30 14:08:17 -050018
19int main(int argc, char* argv[])
20{
21 auto bus = sdbusplus::bus::new_default();
22 auto event = sdeventplus::Event::get_default();
23 bus.attach_event(event.get(), SD_EVENT_PRIORITY_NORMAL);
Andrew Geissleree3a2c82019-07-30 15:16:20 -050024 std::vector<std::string> filePaths;
Andrew Geissler891213b2019-07-30 14:08:17 -050025
Andrew Geissleree3a2c82019-07-30 15:16:20 -050026 CLI::App app{"OpenBmc systemd target monitor"};
27 app.add_option("-f,--file", filePaths,
28 "Full path to json file(s) with target/error mappings");
29
30 CLI11_PARSE(app, argc, argv);
31
32 if (filePaths.empty())
33 {
34 log<level::ERR>("No input files");
35 print_usage();
36 exit(-1);
37 }
Andrew Geissler891213b2019-07-30 14:08:17 -050038
39 // TODO - Load in json config file(s)
40
41 // TODO - Begin monitoring for systemd unit changes and logging appropriate
42 // errors
43
44 return event.loop();
45}