cmd: ufetch: only show comma separator if there was a previous feature

Currently, if NET is disabled, the next feature to be printed will start
with a comma and a space which is not pretty. Add the comma and
whitespace only when a previous feature has already been shown.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
Reviewed-by: Casey Connolly <casey.connolly@linaro.org>
Link: https://patch.msgid.link/20260505-ufetch-net-v3-2-eee5eb9ca5ce@cherry.de
Signed-off-by: Casey Connolly <casey.connolly@linaro.org>
This commit is contained in:
Quentin Schulz
2026-05-05 11:14:32 +02:00
committed by Casey Connolly
parent 53e6ccc0c1
commit 218cbc4b12

View File

@@ -157,26 +157,37 @@ static int do_ufetch(struct cmd_tbl *cmdtp, int flag, int argc,
printf(" (%d baud)", gd->baudrate);
putc('\n');
break;
case FEATURES:
case FEATURES: {
const char *sep = "";
printf("Features:" RESET " ");
if (IS_ENABLED(CONFIG_NET))
printf("Net");
if (IS_ENABLED(CONFIG_EFI_LOADER))
printf(", EFI");
if (IS_ENABLED(CONFIG_CMD_CAT))
printf(", cat :3");
if (IS_ENABLED(CONFIG_NET)) {
printf("%sNet", sep);
sep = ", ";
}
if (IS_ENABLED(CONFIG_EFI_LOADER)) {
printf("%sEFI", sep);
sep = ", ";
}
if (IS_ENABLED(CONFIG_CMD_CAT)) {
printf("%scat :3", sep);
sep = ", ";
}
#ifdef CONFIG_ARM64
switch (current_el()) {
case 2:
printf(", VMs");
printf("%sVMs", sep);
sep = ", ";
break;
case 3:
printf(", full control!");
printf("%sfull control!", sep);
sep = ", ";
break;
}
#endif
printf("\n");
break;
}
case RELOCATION:
if (gd->flags & GD_FLG_SKIP_RELOC)
printf("Relocated:" RESET " no\n");