Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion app/llama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,24 @@ static bool matches(const std::string & arg, const command & cmd) {
return false;
}

static bool is_cmd(std::string arg) {
for (const auto & cmd : cmds) {
if (matches(arg, cmd)) {
return true;
}
}
return false;
}

int main(int argc, char ** argv) {
progname = argv[0];

const std::string arg = argc >= 2 ? argv[1] : "help";
const bool help_cmd = argc >= 3 && argv[1] == "help" && is_cmd(argv[2]);

if (help_cmd) {
return main(3, {argv[2], "--help"});
}

for (const auto & cmd : cmds) {
if (matches(arg, cmd)) {
// keep cmd.name so the router's child processes re-invoke correctly
Expand Down