This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Main OpenOCD repository".
The branch, master has been updated
via fcce5d52d9afd6c7fa04da72534486a3a96cc178 (commit)
via 586c8981b15f4bd4f1248a8b44f611d6fca177a6 (commit)
from 3e7a7092d47ceca874166839d6e88439c911f452 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit fcce5d52d9afd6c7fa04da72534486a3a96cc178
Author: Antonio Borneo <bor...@gm...>
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 <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9185
Tested-by: jenkins
Reviewed-by: Evgeniy Naydanov <eu...@gm...>
diff --git a/src/helper/command.c b/src/helper/command.c
index cc660b8b6..d2a031478 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 {
commit 586c8981b15f4bd4f1248a8b44f611d6fca177a6
Author: Antonio Borneo <bor...@gm...>
Date: Thu Oct 23 23:27:45 2025 +0200
command: let 'help' and 'usage' to use command_print()
The commands 'help' and 'usage' still rely on LOG_USER_N() and
LOG_USER() for the output.
Convert them to command_print().
Change-Id: I6e77dd761b61344ff797f661456896388bba89aa
Signed-off-by: Antonio Borneo <bor...@gm...>
Reviewed-on: https://review.openocd.org/c/openocd/+/9184
Reviewed-by: Evgeniy Naydanov <eu...@gm...>
Tested-by: jenkins
diff --git a/src/helper/command.c b/src/helper/command.c
index 4cce57f75..cc660b8b6 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -674,12 +674,13 @@ static COMMAND_HELPER(command_help_show_list, bool show_help, const char *cmd_ma
#define HELP_LINE_WIDTH(_n) (int)(76 - (2 * _n))
-static void command_help_show_indent(unsigned int n)
+static void command_help_show_indent(struct command_invocation *cmd, unsigned int n)
{
for (unsigned int i = 0; i < n; i++)
- LOG_USER_N(" ");
+ command_print_sameline(cmd, " ");
}
-static void command_help_show_wrap(const char *str, unsigned int n, unsigned int n2)
+static void command_help_show_wrap(struct command_invocation *cmd,
+ const char *str, unsigned int n, unsigned int n2)
{
const char *cp = str, *last = str;
while (*cp) {
@@ -692,8 +693,8 @@ static void command_help_show_wrap(const char *str, unsigned int n, unsigned int
} while ((next - last < HELP_LINE_WIDTH(n)) && *next != '\0');
if (next - last < HELP_LINE_WIDTH(n))
cp = next;
- command_help_show_indent(n);
- LOG_USER("%.*s", (int)(cp - last), last);
+ command_help_show_indent(cmd, n);
+ command_print(cmd, "%.*s", (int)(cp - last), last);
last = cp + 1;
n = n2;
}
@@ -715,10 +716,10 @@ static COMMAND_HELPER(command_help_show, struct help_entry *c,
if (is_match) {
if (c->usage && strlen(c->usage) > 0) {
char *msg = alloc_printf("%s %s", c->cmd_name, c->usage);
- command_help_show_wrap(msg, n, n + 5);
+ command_help_show_wrap(CMD, msg, n, n + 5);
free(msg);
} else {
- command_help_show_wrap(c->cmd_name, n, n + 5);
+ command_help_show_wrap(CMD, c->cmd_name, n, n + 5);
}
}
@@ -752,7 +753,7 @@ static COMMAND_HELPER(command_help_show, struct help_entry *c,
return ERROR_FAIL;
}
- command_help_show_wrap(msg, n + 3, n + 3);
+ command_help_show_wrap(CMD, msg, n + 3, n + 3);
free(msg);
}
-----------------------------------------------------------------------
Summary of changes:
src/helper/command.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
hooks/post-receive
--
Main OpenOCD repository
|