aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/target/target.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/target/target.c b/src/target/target.c
index 4e29146..ae5f74c 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -6365,19 +6365,16 @@ static int target_create(struct jim_getopt_info *goi)
return JIM_OK;
}
-static int jim_target_current(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
+COMMAND_HANDLER(handle_target_current)
{
- if (argc != 1) {
- Jim_WrongNumArgs(interp, 1, argv, "Too many parameters");
- return JIM_ERR;
- }
- struct command_context *cmd_ctx = current_command_context(interp);
- assert(cmd_ctx);
+ if (CMD_ARGC != 0)
+ return ERROR_COMMAND_SYNTAX_ERROR;
- struct target *target = get_current_target_or_null(cmd_ctx);
+ struct target *target = get_current_target_or_null(CMD_CTX);
if (target)
- Jim_SetResultString(interp, target_name(target), -1);
- return JIM_OK;
+ command_print(CMD, "%s", target_name(target));
+
+ return ERROR_OK;
}
static int jim_target_types(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
@@ -6522,8 +6519,9 @@ static const struct command_registration target_subcommand_handlers[] = {
{
.name = "current",
.mode = COMMAND_ANY,
- .jim_handler = jim_target_current,
+ .handler = handle_target_current,
.help = "Returns the currently selected target",
+ .usage = "",
},
{
.name = "types",