blob: 8935568b5760e56405cc1d84706e74a91953f630 [file] [log] [blame]
Gunnar Mills72639152017-06-22 15:06:21 -05001#include <iostream>
2#include <phosphor-logging/log.hpp>
3#include "argument.hpp"
4#include "gpio_presence.hpp"
5
6using namespace phosphor::logging;
7using namespace phosphor::gpio;
Gunnar Mills5f101102017-06-29 13:07:39 -05008using namespace phosphor::gpio::presence;
Gunnar Mills72639152017-06-22 15:06:21 -05009
10int main(int argc, char* argv[])
11{
12 auto options = ArgumentParser(argc, argv);
13
14 auto inventory = options["inventory"];
15 auto key = options["key"];
16 auto path = options["path"];
17 if (argc < 4)
18 {
19 std::cerr << "Too few arguments\n";
20 options.usage(argv);
21 }
22
23 if (inventory == ArgumentParser::emptyString)
24 {
25 std::cerr << "Inventory argument required\n";
26 options.usage(argv);
27 }
28
29 if (key == ArgumentParser::emptyString)
30 {
31 std::cerr << "GPIO key argument required\n";
32 options.usage(argv);
33 }
34
35 if (path == ArgumentParser::emptyString)
36 {
37 std::cerr << "Device path argument required\n";
38 options.usage(argv);
39 }
Gunnar Mills5f101102017-06-29 13:07:39 -050040 Presence presence(inventory, path, std::stoul(key), options["name"]);
Gunnar Mills72639152017-06-22 15:06:21 -050041
42 return 0;
43}
44