codecreate/main.cpp
2024-05-28 10:09:34 +08:00

40 lines
774 B
C++

#include <CLI11.hpp>
#include <iostream>
#include <string>
#include <filesystem>
#define CODECREATE_VERSION "1.0.0"
struct MParam {
std::string des_path{};
};
namespace fs = std::filesystem;
bool parse_cmd(int argc, char** argv, MParam& param)
{
std::string intro("");
intro.append(CODECREATE_VERSION);
CLI::App app(intro);
app.add_option("-p,--path", param.des_path, "创建工程的位置");
try {
CLI11_PARSE(app, argc, argv);
return true;
} catch (const CLI::ParseError& e) {
std::cerr << "Error parsing command line: " << e.what() << std::endl;
return false;
}
}
int main(int argc, char** argv)
{
MParam param;
if (!parse_cmd(argc, argv, param)) {
return -1;
}
return 0;
}