From 8bcdda2639a4eb66bf3f727a302cf5eda7dcb3de Mon Sep 17 00:00:00 2001 From: nekosu Date: Sat, 21 Oct 2023 22:32:01 +0800 Subject: [PATCH] feat: add machine interface for rpc cli --- source/MaaRpc/cli/main.cpp | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/source/MaaRpc/cli/main.cpp b/source/MaaRpc/cli/main.cpp index 30756fb4e..88a7350f2 100644 --- a/source/MaaRpc/cli/main.cpp +++ b/source/MaaRpc/cli/main.cpp @@ -9,6 +9,7 @@ std::mutex mutex; std::condition_variable cv; +bool mi = false; bool quiet = false; bool quit = false; @@ -40,6 +41,9 @@ int main(int argc, char* argv[]) else if (opt == "-q") { quiet = true; } + else if (opt == "-mi") { + mi = true; + } else if (opt.starts_with("-p=")) { port = std::stoi(opt.substr(3)); } @@ -57,13 +61,28 @@ int main(int argc, char* argv[]) std::unique_lock lock(mutex); if (!quiet) { - std::cout << "Server listening on " << server_address << std::endl; + if (mi) { + std::cout << "[MAARPC]START|" << server_address << std::endl; + } + else { + std::cout << "Server listening on " << server_address << std::endl; + } } cv.wait(lock, []() { return quit; }); - std::cout << "Start stopping" << std::endl; + if (mi) { + std::cout << "[MAARPC]STOP" << std::endl; + } + else { + std::cout << "Start stopping" << std::endl; + } MaaRpcStop(); - std::cout << "Exit" << std::endl; + if (mi) { + std::cout << "[MAARPC]EXIT" << std::endl; + } + else { + std::cout << "Exit" << std::endl; + } return 0; }