mirror of
https://github.com/radareorg/radare2.git
synced 2025-03-04 04:17:25 +00:00
Add JSON output to Ls command (#9637)
This commit is contained in:
parent
1c1cad1d94
commit
cad295e740
@ -175,17 +175,31 @@ static int cmd_plugins(void *data, const char *input) {
|
||||
case '?':
|
||||
r_core_cmd_help (core, help_msg_L);
|
||||
break;
|
||||
case 's':
|
||||
if (input[1]) {
|
||||
return r_core_cmd0 (core, input + 2);
|
||||
} else {
|
||||
RListIter *iter;
|
||||
RCorePlugin *cp;
|
||||
case 's': {
|
||||
RListIter *iter;
|
||||
RCorePlugin *cp;
|
||||
switch (input[1]) {
|
||||
case 'j': {
|
||||
r_cons_printf("{[");
|
||||
bool is_first_element = true;
|
||||
r_list_foreach (core->rcmd->plist, iter, cp) {
|
||||
r_cons_printf ("%s{\"Name:\":%s,\"Description:%s\"}",
|
||||
is_first_element? "" : ",", cp->name, cp->desc);
|
||||
is_first_element = false;
|
||||
}
|
||||
r_cons_printf("}]\n");
|
||||
break;
|
||||
}
|
||||
case 0 :
|
||||
r_list_foreach (core->rcmd->plist, iter, cp) {
|
||||
r_cons_printf ("%s: %s\n", cp->name, cp->desc);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return r_core_cmd0 (core, input + 2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user