From ca8f60f3adc860aaff551cc1e3b58589a8e98fe3 Mon Sep 17 00:00:00 2001 From: Sophist <3001893+Sophist-UK@users.noreply.github.com> Date: Thu, 25 Jun 2026 12:05:11 +0100 Subject: [PATCH 1/2] Add `help ` as alias for ` --help` Allow user to use e.g. `llama help serve" as an alias for `llama serve --help`. 1. Adds a helper to check if help target is a valid command 2. Calls recursively with the alias. --- app/llama.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/app/llama.cpp b/app/llama.cpp index c4578ea53b6c..14da2ba64ae4 100644 --- a/app/llama.cpp +++ b/app/llama.cpp @@ -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 From d984d951fdd99d2db20f2485abee331abcbdfae3 Mon Sep 17 00:00:00 2001 From: Sophist <3001893+Sophist-UK@users.noreply.github.com> Date: Thu, 25 Jun 2026 12:17:51 +0100 Subject: [PATCH 2/2] Fix typos --- app/llama.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/llama.cpp b/app/llama.cpp index 14da2ba64ae4..ffec1196ac26 100644 --- a/app/llama.cpp +++ b/app/llama.cpp @@ -124,7 +124,7 @@ static bool is_cmd(std::string arg) { return true; } } - return false + return false; } int main(int argc, char ** argv) { @@ -133,7 +133,7 @@ int main(int argc, char ** argv) { const bool help_cmd = argc >= 3 && argv[1] == "help" && is_cmd(argv[2]); if (help_cmd) { - return main(3, {argv[2], "--help"); + return main(3, {argv[2], "--help"}); } for (const auto & cmd : cmds) {