加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
argument.cpp 1.00 KB
一键复制 编辑 原始数据 按行查看 历史
Nan Zhou 提交于 2022-09-16 03:41 . clang-tidy: enable clang-tidy
#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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化