shell: colorize the ell command (#5687)

This commit is contained in:
Ayush Goyal 2025-12-30 02:02:39 +05:30 committed by GitHub
parent fb4822d658
commit 5d6f19579e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 24 additions and 10 deletions

View file

@ -1885,11 +1885,24 @@ static void config_print_node(RzConfig *cfg, RzConfigNode *node, RzCmdStateOutpu
}
pj_end(pj);
break;
case RZ_OUTPUT_MODE_LONG:
rz_cons_printf("%s = %s %s; %s",
node->name, node->value,
rz_config_node_is_ro(node) ? "(ro)" : "",
node->desc);
case RZ_OUTPUT_MODE_LONG: {
bool color_enabled = rz_config_get_i(cfg, "scr.color") > 0;
char color_name[32], color_value[32], color_meta[32], reset_str[32];
if (color_enabled) {
RzColor color_name_val = rz_cons_pal_get("label");
RzColor color_value_val = rz_cons_pal_get("args");
RzColor color_meta_val = rz_cons_pal_get("comment");
RzColor reset_val = rz_cons_pal_get("help");
rz_cons_rgb_str(color_name, sizeof(color_name), &color_name_val);
rz_cons_rgb_str(color_value, sizeof(color_value), &color_value_val);
rz_cons_rgb_str(color_meta, sizeof(color_meta), &color_meta_val);
rz_cons_rgb_str(reset_str, sizeof(reset_str), &reset_val);
} else {
color_name[0] = color_value[0] = color_meta[0] = reset_str[0] = '\0';
}
const char *ro_str = rz_config_node_is_ro(node) ? "(ro)" : "";
rz_cons_printf("%s%20s = %s%s %s%s; %s%s", color_name, node->name, color_value, node->value, color_meta, ro_str, reset_str, node->desc);
if (!rz_list_empty(node->options)) {
isFirst = true;
rz_cons_printf(" [");
@ -1905,6 +1918,7 @@ static void config_print_node(RzConfig *cfg, RzConfigNode *node, RzCmdStateOutpu
}
rz_cons_println("");
break;
}
case RZ_OUTPUT_MODE_QUIET:
rz_cons_printf("%s=%s\n", node->name, node->value);
break;

View file

@ -180,11 +180,11 @@ EXPECT=<<EOF
zoom.in: Specify boundaries for zoom
zoom.maxsz: Zoom max size of block
zoom.to: Zoom end address
zoom.byte = h ; Zoom callback to calculate each byte (See pz? for help)
zoom.from = 0 ; Zoom start address
zoom.in = io.map ; Specify boundaries for zoom [raw, block, bin.section, bin.sections, bin.sections.rwx, bin.sections.r, bin.sections.rw, bin.sections.rx, bin.sections.wx, bin.sections.x, io.map, io.maps, io.maps.rwx, io.maps.r, io.maps.rw, io.maps.rx, io.maps.wx, io.maps.x, dbg.stack, dbg.heap, dbg.map, dbg.maps, dbg.maps.rwx, dbg.maps.r, dbg.maps.rw, dbg.maps.rx, dbg.maps.wx, dbg.maps.x, analysis.fcn, analysis.bb]
zoom.maxsz = 512 ; Zoom max size of block
zoom.to = 0 ; Zoom end address
zoom.byte = h ; Zoom callback to calculate each byte (See pz? for help)
zoom.from = 0 ; Zoom start address
zoom.in = io.map ; Specify boundaries for zoom [raw, block, bin.section, bin.sections, bin.sections.rwx, bin.sections.r, bin.sections.rw, bin.sections.rx, bin.sections.wx, bin.sections.x, io.map, io.maps, io.maps.rwx, io.maps.r, io.maps.rw, io.maps.rx, io.maps.wx, io.maps.x, dbg.stack, dbg.heap, dbg.map, dbg.maps, dbg.maps.rwx, dbg.maps.r, dbg.maps.rw, dbg.maps.rx, dbg.maps.wx, dbg.maps.x, analysis.fcn, analysis.bb]
zoom.maxsz = 512 ; Zoom max size of block
zoom.to = 0 ; Zoom end address
zoom.byte=h
zoom.from=0
zoom.in=io.map