forked from ibm-openbmc/phosphor-certificate-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
argument.cpp
32 lines (28 loc) · 1 KB
/
argument.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "argument.hpp"
#include "certificate.hpp"
#include <CLI/CLI.hpp>
namespace phosphor::certs
{
int processArguments(int argc, const char* const* argv, Arguments& arguments)
{
CLI::App app{"OpenBMC Certificate Management Daemon"};
app.add_option("-t,--type", arguments.typeStr, "certificate type")
->required();
app.add_option("-e,--endpoint", arguments.endpoint, "d-bus endpoint")
->required();
app.add_option("-p,--path", arguments.path, "certificate file path")
->required();
app.add_option("-u,--unit", arguments.unit,
"Optional systemd unit need to reload")
->capture_default_str();
CLI11_PARSE(app, argc, argv);
phosphor::certs::CertificateType type =
phosphor::certs::stringToCertificateType(arguments.typeStr);
if (type == phosphor::certs::CertificateType::unsupported)
{
std::cerr << "type not specified or invalid." << std::endl;
return 1;
}
return 0;
}
} // namespace phosphor::certs