From 4d9944c108a69b16d9272173abde25c5b01e6b11 Mon Sep 17 00:00:00 2001 From: dongwlin Date: Sat, 9 Dec 2023 15:55:16 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20version=20=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/cli/main.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/source/cli/main.cpp b/source/cli/main.cpp index 72ecb91..af56a24 100644 --- a/source/cli/main.cpp +++ b/source/cli/main.cpp @@ -8,6 +8,11 @@ int main(int argc, char** argv) return 1; } + if (flags["version"]) { + print_version(); + return 0; + } + if (flags["help"]) { print_help(); return 0; @@ -170,8 +175,8 @@ int main(int argc, char** argv) bool parse_param(int argc, char** argv, std::unordered_map& options, std::unordered_map& flags) { - std::unordered_set allowed_param = { "control", "device", "tasks", "init", "help" }; - std::unordered_set flags_key = { "init", "help" }; + std::unordered_set allowed_param = { "control", "device", "tasks", "init", "help", "version" }; + std::unordered_set flags_key = { "init", "help", "version" }; for (auto& key : flags_key) { flags[key] = false; }