PackBinary/cmd_parse.cpp

39 lines
895 B
C++
Raw Normal View History

2024-10-27 15:51:46 +08:00
#include "cmd_parse.h"
2024-10-29 12:42:11 +08:00
#include <iostream>
2024-10-27 15:51:46 +08:00
2024-10-29 12:42:11 +08:00
CCmdParse::CCmdParse()
2024-10-27 15:51:46 +08:00
{
}
2024-10-29 12:42:11 +08:00
bool CCmdParse::cmdParse(int argc, char* argv[])
2024-10-27 15:51:46 +08:00
{
2024-10-29 12:42:11 +08:00
cmd::options_description desc("options");
desc.add_options()("help,h", "produce help message")(
"dirs,d", cmd::value<std::vector<std::string>>()->multitoken(),
"set search dirs")("mode,m", cmd::value<int>()->default_value(-1),
"设置执行模式,0-打包,1-安装");
cmd::variables_map vm;
cmd::store(cmd::parse_command_line(argc, argv, desc), vm);
cmd::notify(vm);
if (vm.count("help")) {
std::cout << desc;
return false;
2024-10-27 15:51:46 +08:00
}
2024-10-29 12:42:11 +08:00
if (vm.count("mode")) {
result_.mode = vm["mode"].as<int>();
2024-10-27 15:51:46 +08:00
}
2024-10-29 12:42:11 +08:00
if (vm.count("dir")) {
result_.lib_dirs = vm["dir"].as<std::vector<std::string>>();
2024-10-27 15:51:46 +08:00
}
2024-10-29 12:42:11 +08:00
return true;
2024-10-27 15:51:46 +08:00
}
2024-10-29 12:42:11 +08:00
bool CCmdParse::checkArgs()
2024-10-27 15:51:46 +08:00
{
2024-10-29 12:42:11 +08:00
return false;
2024-10-27 15:51:46 +08:00
}