diff --git a/fileUpdater/main.cpp b/fileUpdater/main.cpp index 28cd9a0..69b6d0d 100644 --- a/fileUpdater/main.cpp +++ b/fileUpdater/main.cpp @@ -84,8 +84,9 @@ public: // 解析命令行参数 bool parseArguments(int argc, char** argv) { - auto msg = fmt::format("fileUpdater - 文件更新工具 \n\n {} on {} at {} {}", VERSION_GIT_COMMIT, VERSION_GIT_BRANCH, - __DATE__, __TIME__); + auto notice = "使用特殊参数 default 可生成一个默认配置文件模板。"; + auto msg = fmt::format("fileUpdater - 文件更新工具 \n\n {} on {} at {} {}\n{}", VERSION_GIT_COMMIT, VERSION_GIT_BRANCH, + __DATE__, __TIME__, notice); CLI::App app{msg}; argv = app.ensure_utf8(argv); @@ -479,6 +480,28 @@ int main(int argc, char** argv) zoostCommon::SetOutputU8(); zoostCommon::SetStdLibrayU8(); + if (argc > 1) { + std::string specialStr = argv[1]; + if (specialStr == "default") { + std::string defaultContent = + R"( + + + + +)"; + std::ifstream ifs("fileUpdater.xml"); + if (!ifs) { + std::ofstream ofs("fileUpdater.xml"); + ofs << defaultContent; + ofs.close(); + } + ifs.close(); + boost::nowide::cout << "已生成默认配置文件: fileUpdater.xml" << std::endl; + return 0; + } + } + AutoUpdateTool tool; if (tool.parseArguments(argc, argv)) {