target: rewrite command 'target curstate' as COMMAND_HANDLER
While there, add the mandatory 'usage' field. Change-Id: Ibfda6f56a1450e2eb9ad3092d756de0778f4a092 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: https://review.openocd.org/c/openocd/+/7504 Tested-by: jenkins
This commit is contained in:
parent
584986ab1c
commit
113ba58231
|
@ -5904,18 +5904,19 @@ COMMAND_HANDLER(handle_target_event_list)
|
|||
command_print(CMD, "***END***");
|
||||
return ERROR_OK;
|
||||
}
|
||||
static int jim_target_current_state(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
|
||||
|
||||
COMMAND_HANDLER(handle_target_current_state)
|
||||
{
|
||||
if (argc != 1) {
|
||||
Jim_WrongNumArgs(interp, 1, argv, "[no parameters]");
|
||||
return JIM_ERR;
|
||||
}
|
||||
struct command_context *cmd_ctx = current_command_context(interp);
|
||||
assert(cmd_ctx);
|
||||
struct target *target = get_current_target(cmd_ctx);
|
||||
Jim_SetResultString(interp, target_state_name(target), -1);
|
||||
return JIM_OK;
|
||||
if (CMD_ARGC != 0)
|
||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||
|
||||
struct target *target = get_current_target(CMD_CTX);
|
||||
|
||||
command_print(CMD, "%s", target_state_name(target));
|
||||
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
static int jim_target_invoke_event(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
|
||||
{
|
||||
struct jim_getopt_info goi;
|
||||
|
@ -6063,8 +6064,9 @@ static const struct command_registration target_instance_command_handlers[] = {
|
|||
{
|
||||
.name = "curstate",
|
||||
.mode = COMMAND_EXEC,
|
||||
.jim_handler = jim_target_current_state,
|
||||
.handler = handle_target_current_state,
|
||||
.help = "displays the current state of this target",
|
||||
.usage = "",
|
||||
},
|
||||
{
|
||||
.name = "arp_examine",
|
||||
|
|
Loading…
Reference in New Issue