11#include " command_line_parser.h"
22#include " commands/chat_cmd.h"
33#include " commands/cmd_info.h"
4+ #include " commands/engine_get_cmd.h"
45#include " commands/engine_init_cmd.h"
56#include " commands/engine_list_cmd.h"
67#include " commands/engine_uninstall_cmd.h"
@@ -125,11 +126,11 @@ bool CommandLineParser::SetupCommand(int argc, char** argv) {
125126 command.Exec ();
126127 });
127128
128- auto get_engine_cmd = engines_cmd->add_subcommand (" get" , " Get an engine" );
129+ EngineManagement (engines_cmd, " cortex.llamacpp" , version);
130+ EngineManagement (engines_cmd, " cortex.onnx" , version);
131+ EngineManagement (engines_cmd, " cortex.tensorrt-llm" , version);
129132
130- EngineInstall (engines_cmd, " cortex.llamacpp" , version);
131- EngineInstall (engines_cmd, " cortex.onnx" , version);
132- EngineInstall (engines_cmd, " cortex.tensorrt-llm" , version);
133+ EngineGet (engines_cmd);
133134 }
134135
135136 {
@@ -158,9 +159,9 @@ bool CommandLineParser::SetupCommand(int argc, char** argv) {
158159 return true ;
159160}
160161
161- void CommandLineParser::EngineInstall (CLI::App* parent,
162- const std::string& engine_name,
163- std::string& version) {
162+ void CommandLineParser::EngineManagement (CLI::App* parent,
163+ const std::string& engine_name,
164+ std::string& version) {
164165 auto engine_cmd =
165166 parent->add_subcommand (engine_name, " Manage " + engine_name + " engine" );
166167
@@ -181,3 +182,17 @@ void CommandLineParser::EngineInstall(CLI::App* parent,
181182 cmd.Exec ();
182183 });
183184}
185+
186+ void CommandLineParser::EngineGet (CLI::App* parent) {
187+ auto get_cmd = parent->add_subcommand (" get" , " Get an engine info" );
188+
189+ for (auto & engine : supportedEngines_) {
190+ std::string engine_name{engine};
191+ std::string desc = " Get " + engine_name + " status" ;
192+ auto engine_get_cmd = get_cmd->add_subcommand (engine, desc);
193+ engine_get_cmd->callback ([engine_name] {
194+ commands::EngineGetCmd cmd (engine_name);
195+ cmd.Exec ();
196+ });
197+ }
198+ }
0 commit comments