From c9ffefeb63ca693e6dfee700337d7ed50dd7f6da Mon Sep 17 00:00:00 2001 From: vansangpfiev Date: Thu, 5 Sep 2024 16:09:15 +0700 Subject: [PATCH] fix: add todo --- engine/commands/cortex_upd_cmd.cc | 5 +++-- engine/commands/cortex_upd_cmd.h | 2 +- engine/controllers/command_line_parser.cc | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/engine/commands/cortex_upd_cmd.cc b/engine/commands/cortex_upd_cmd.cc index 165ede4e3..e9cccc8a9 100644 --- a/engine/commands/cortex_upd_cmd.cc +++ b/engine/commands/cortex_upd_cmd.cc @@ -20,7 +20,7 @@ const std::string kCortexBinary = "cortex-cpp"; CortexUpdCmd::CortexUpdCmd() {} -void CortexUpdCmd::Exec() { +void CortexUpdCmd::Exec(std::string v) { // Check if the architecture and OS are supported auto system_info = system_info_utils::GetSystemInfo(); if (system_info.arch == system_info_utils::kUnsupported || @@ -33,7 +33,8 @@ void CortexUpdCmd::Exec() { // Download file constexpr auto github_host = "https://api.github.com"; - // std::string version = version_.empty() ? "latest" : version_; + // std::string version = v.empty() ? "latest" : std::move(v); + // TODO(sang): support download with version std::string version = "latest"; std::ostringstream release_path; release_path << "/repos/janhq/cortex.cpp/releases/" << version; diff --git a/engine/commands/cortex_upd_cmd.h b/engine/commands/cortex_upd_cmd.h index 32a1096b6..b90a46bc4 100644 --- a/engine/commands/cortex_upd_cmd.h +++ b/engine/commands/cortex_upd_cmd.h @@ -7,7 +7,7 @@ namespace commands { class CortexUpdCmd{ public: CortexUpdCmd(); - void Exec(); + void Exec(std::string version); private: }; diff --git a/engine/controllers/command_line_parser.cc b/engine/controllers/command_line_parser.cc index 9613ea0be..6e4270914 100644 --- a/engine/controllers/command_line_parser.cc +++ b/engine/controllers/command_line_parser.cc @@ -174,7 +174,7 @@ bool CommandLineParser::SetupCommand(int argc, char** argv) { update_cmd->add_option("-v", cortex_version, ""); update_cmd->callback([&cortex_version, &check_update] { commands::CortexUpdCmd cuc; - cuc.Exec(); + cuc.Exec(cortex_version); check_update = false; }); }