Skip to content

Commit

Permalink
feat: version 命令
Browse files Browse the repository at this point in the history
  • Loading branch information
dongwlin committed Dec 9, 2023
1 parent 1b327f1 commit 4d9944c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions source/cli/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -170,8 +175,8 @@ int main(int argc, char** argv)
bool parse_param(int argc, char** argv, std::unordered_map<std::string, std::string>& options,
std::unordered_map<std::string, bool>& flags)
{
std::unordered_set<std::string> allowed_param = { "control", "device", "tasks", "init", "help" };
std::unordered_set<std::string> flags_key = { "init", "help" };
std::unordered_set<std::string> allowed_param = { "control", "device", "tasks", "init", "help", "version" };
std::unordered_set<std::string> flags_key = { "init", "help", "version" };
for (auto& key : flags_key) {
flags[key] = false;
}
Expand Down

0 comments on commit 4d9944c

Please sign in to comment.