This is an automated email from Gerrit. "Antonio Borneo <borneo.anto...@gmail.com>" just uploaded a new patch set to Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7509
-- gerrit commit 704134de7ca656edbb80e221b9bb7e152caf922d Author: Antonio Borneo <borneo.anto...@gmail.com> Date: Mon Dec 19 23:54:10 2022 +0100 target: rewrite command 'target types' as COMMAND_HANDLER Print one entry per line. While there add the mandatory 'usage' field. Change-Id: I135556e12154e33fdbd0f71d89f6fe37c69813b7 Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com> diff --git a/src/target/target.c b/src/target/target.c index ae5f74cbf7..b77a25a2a3 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -6377,18 +6377,15 @@ COMMAND_HANDLER(handle_target_current) return ERROR_OK; } -static int jim_target_types(Jim_Interp *interp, int argc, Jim_Obj *const *argv) +COMMAND_HANDLER(handle_target_types) { - if (argc != 1) { - Jim_WrongNumArgs(interp, 1, argv, "Too many parameters"); - return JIM_ERR; - } - Jim_SetResult(interp, Jim_NewListObj(interp, NULL, 0)); - for (unsigned x = 0; target_types[x]; x++) { - Jim_ListAppendElement(interp, Jim_GetResult(interp), - Jim_NewStringObj(interp, target_types[x]->name, -1)); - } - return JIM_OK; + if (CMD_ARGC != 0) + return ERROR_COMMAND_SYNTAX_ERROR; + + for (unsigned int x = 0; target_types[x]; x++) + command_print(CMD, "%s", target_types[x]->name); + + return ERROR_OK; } static int jim_target_names(Jim_Interp *interp, int argc, Jim_Obj *const *argv) @@ -6526,9 +6523,10 @@ static const struct command_registration target_subcommand_handlers[] = { { .name = "types", .mode = COMMAND_ANY, - .jim_handler = jim_target_types, + .handler = handle_target_types, .help = "Returns the available target types as " "a list of strings", + .usage = "", }, { .name = "names", --