From 9f6a88b15f5612550c03394e2af2d6e0ae62d367 Mon Sep 17 00:00:00 2001 From: MistEO Date: Fri, 23 Feb 2024 00:20:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96PiCli=E4=BA=A4?= =?UTF-8?q?=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/MaaProjectInterfaceCli/interactor.cpp | 9 ++++++++- source/ProjectInterface/Parser/Parser.cpp | 2 +- source/include/ProjectInterface/Types.h | 5 ++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/source/MaaProjectInterfaceCli/interactor.cpp b/source/MaaProjectInterfaceCli/interactor.cpp index 0faf6f40c..63e2fb55a 100644 --- a/source/MaaProjectInterfaceCli/interactor.cpp +++ b/source/MaaProjectInterfaceCli/interactor.cpp @@ -101,7 +101,14 @@ void Interactor::print_config() const void Interactor::welcome() const { - std::cout << "Welcome to use Maa Project Interface CLI!\n\n"; + if (config_.interface_data().message.empty()) { + std::cout << "Welcome to use Maa Project Interface CLI!\n\n"; + } + else { + std::cout << MaaNS::utf8_to_crt(config_.interface_data().message) << "\n\n"; + } + + std::cout << "Version: " << MaaNS::utf8_to_crt(config_.interface_data().version) << "\n\n"; } bool Interactor::interact_once() diff --git a/source/ProjectInterface/Parser/Parser.cpp b/source/ProjectInterface/Parser/Parser.cpp index 8e5677194..eb58887ae 100644 --- a/source/ProjectInterface/Parser/Parser.cpp +++ b/source/ProjectInterface/Parser/Parser.cpp @@ -37,7 +37,7 @@ std::optional Parser::parse_interface(const json::value& json) } } } - + LogInfo << "Interface Version:" << VAR(data.version); return data; } diff --git a/source/include/ProjectInterface/Types.h b/source/include/ProjectInterface/Types.h index 850d8ea5b..b58103053 100644 --- a/source/include/ProjectInterface/Types.h +++ b/source/include/ProjectInterface/Types.h @@ -72,8 +72,11 @@ struct InterfaceData std::unordered_map option; std::unordered_map recognizer; std::unordered_map action; + std::string version; + std::string message; - MEO_JSONIZATION(MEO_OPT controller, resource, task, MEO_OPT option, MEO_OPT recognizer, MEO_OPT action); + MEO_JSONIZATION(MEO_OPT controller, resource, task, MEO_OPT option, MEO_OPT recognizer, MEO_OPT action, + MEO_OPT version, MEO_OPT message); }; struct Configuration