Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 7247e8e

Browse files
chore: refactor setup from running
1 parent 1db42eb commit 7247e8e

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

engine/cli/command_line_parser.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ CommandLineParser::CommandLineParser()
5353
engine_service_{std::make_shared<EngineService>(
5454
download_service_, dylib_path_manager_, db_service_)} {}
5555

56-
bool CommandLineParser::SetupCommand(int argc, char** argv) {
56+
bool CommandLineParser::SetupCommand() {
5757
app_.usage("Usage:\n" + commands::GetCortexBinary() +
5858
" [options] [subcommand]");
5959
cml_data_.config = file_manager_utils::GetCortexConfig();
@@ -90,6 +90,10 @@ bool CommandLineParser::SetupCommand(int argc, char** argv) {
9090
};
9191
app_.add_flag_function("-v,--version", cb, "Get Cortex version");
9292

93+
return true;
94+
}
95+
96+
bool CommandLineParser::runCommand(int argc, char** argv) {
9397
CLI11_PARSE(app_, argc, argv);
9498
if (argc == 1) {
9599
CLI_LOG(app_.help());
@@ -138,7 +142,7 @@ bool CommandLineParser::SetupCommand(int argc, char** argv) {
138142
void CommandLineParser::SetupCommonCommands() {
139143
auto model_pull_cmd = app_.add_subcommand(
140144
"pull",
141-
"Download models by HuggingFace Repo/ModelID"
145+
"Download models by HuggingFace Repo/ModelID\n"
142146
"See built-in models: https://huggingface.co/cortexso");
143147
model_pull_cmd->group(kCommonCommandsGroup);
144148
model_pull_cmd->usage("Usage:\n" + commands::GetCortexBinary() +

engine/cli/command_line_parser.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
class CommandLineParser {
1111
public:
1212
CommandLineParser();
13-
bool SetupCommand(int argc, char** argv);
13+
bool SetupCommand();
14+
bool runCommand(int argc, char** argv);
1415

1516
private:
1617
void SetupCommonCommands();
@@ -63,6 +64,6 @@ class CommandLineParser {
6364
CmlData cml_data_;
6465
std::unordered_map<std::string, std::string> config_update_opts_;
6566
bool executed_ = false;
66-
commands::HarwareOptions hw_opts_;
67+
commands::HardwareQueryFlags hw_opts_;
6768
std::unordered_map<std::string, std::string> run_settings_;
6869
};

engine/cli/main.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,10 @@ int main(int argc, char* argv[]) {
219219
}
220220

221221
CommandLineParser clp;
222-
clp.SetupCommand(argc, argv);
222+
if(!clp.SetupCommand()){
223+
CTL_ERR("Not Able to set Commands\n");
224+
exit(1);
225+
}
226+
clp.runCommand(argc, argv);
223227
return 0;
224228
}

0 commit comments

Comments
 (0)