This is an automated email from Gerrit. "Antonio Borneo <[email protected]>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/9185
-- gerrit commit 23e0ff69391c927692be1a57765daddc40ea933b Author: Antonio Borneo <[email protected]> Date: Fri Oct 24 10:07:10 2025 +0200 command: on syntax error, run 'usage' inside the same cmd_ctx We want the output of the 'usage' command to become the output of the current command that has triggered the syntax error. Don't use command_run_linef(), as it will first print the message, then pass it to the current command that will use it again. Replace command_run_linef() with Jim_Eval..(). Change-Id: Icefa87746156e6e8758026c0fdc5e02b440b3aaa Signed-off-by: Antonio Borneo <[email protected]> diff --git a/src/helper/command.c b/src/helper/command.c index cc660b8b65..d2a0314782 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -444,8 +444,8 @@ static int jim_exec_command(Jim_Interp *interp, struct command_context *context, int retval = c->handler(&cmd); if (retval == ERROR_COMMAND_SYNTAX_ERROR) { - /* Print help for command */ - command_run_linef(context, "usage %s", words[0]); + // Print command syntax + Jim_EvalObjPrefix(context->interp, Jim_NewStringObj(context->interp, "usage", -1), 1, argv); } else if (retval == ERROR_COMMAND_CLOSE_CONNECTION) { /* just fall through for a shutdown request */ } else { --
