From fb9d3cc1f80fb0f9bebd4a68fa979150e9980511 Mon Sep 17 00:00:00 2001 From: Anton Kochkov Date: Fri, 6 Sep 2024 22:33:37 +0800 Subject: [PATCH] core/cmd: add QUIET mode for global vars listing (#4617) --- librz/core/canalysis.c | 3 +++ librz/core/cmd_descs/cmd_analysis.yaml | 1 + librz/core/cmd_descs/cmd_descs.c | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/librz/core/canalysis.c b/librz/core/canalysis.c index dad92b020aa..25d278cd25f 100644 --- a/librz/core/canalysis.c +++ b/librz/core/canalysis.c @@ -4497,6 +4497,9 @@ RZ_IPI bool rz_analysis_var_global_list_show(RzAnalysis *analysis, RzCmdStateOut } ut64 var_size = rz_type_db_get_bitsize(analysis->typedb, glob->type) / 8; switch (state->mode) { + case RZ_OUTPUT_MODE_QUIET: + rz_cons_println(glob->name); + break; case RZ_OUTPUT_MODE_STANDARD: rz_cons_printf("global %s %s @ 0x%" PFMT64x "\n", var_type, glob->name, glob->addr); diff --git a/librz/core/cmd_descs/cmd_analysis.yaml b/librz/core/cmd_descs/cmd_analysis.yaml index 93711fdd0dd..20df567d2b6 100644 --- a/librz/core/cmd_descs/cmd_analysis.yaml +++ b/librz/core/cmd_descs/cmd_analysis.yaml @@ -1550,6 +1550,7 @@ commands: cname: analysis_print_global_variable modes: - RZ_OUTPUT_MODE_STANDARD + - RZ_OUTPUT_MODE_QUIET - RZ_OUTPUT_MODE_JSON - RZ_OUTPUT_MODE_TABLE args: diff --git a/librz/core/cmd_descs/cmd_descs.c b/librz/core/cmd_descs/cmd_descs.c index 4742db5664c..ac3a8cfd9d0 100644 --- a/librz/core/cmd_descs/cmd_descs.c +++ b/librz/core/cmd_descs/cmd_descs.c @@ -19977,7 +19977,7 @@ RZ_IPI void rzshell_cmddescs_init(RzCore *core) { rz_warn_if_fail(av_cd); RzCmdDesc *avg_cd = rz_cmd_desc_group_new(core->rcmd, av_cd, "avg", NULL, NULL, &avg_help); rz_warn_if_fail(avg_cd); - RzCmdDesc *analysis_print_global_variable_cd = rz_cmd_desc_argv_state_new(core->rcmd, avg_cd, "avgl", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_TABLE, rz_analysis_print_global_variable_handler, &analysis_print_global_variable_help); + RzCmdDesc *analysis_print_global_variable_cd = rz_cmd_desc_argv_state_new(core->rcmd, avg_cd, "avgl", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_JSON | RZ_OUTPUT_MODE_TABLE, rz_analysis_print_global_variable_handler, &analysis_print_global_variable_help); rz_warn_if_fail(analysis_print_global_variable_cd); RzCmdDesc *analysis_global_variable_add_cd = rz_cmd_desc_argv_new(core->rcmd, avg_cd, "avga", rz_analysis_global_variable_add_handler, &analysis_global_variable_add_help);