U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cmd: env: select: Add output for available evironment targets
@ 2025-03-20 10:32 Christoph Niedermaier
  2025-03-20 11:55 ` Marek Vasut
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Niedermaier @ 2025-03-20 10:32 UTC (permalink / raw)
  To: u-boot
  Cc: Christoph Niedermaier, Marek Vasut, Patrick Delaunay,
	Joe Hershberger, Tom Rini

If "env select" is called without a target parameter the result is
"Select Environment on <NULL>: driver not found". Improve the output
by showing a list of available evironment targets, where the active
target is marked with an asterisk.

Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com>

Cc: Marek Vasut <marex@denx.de>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Cc: Tom Rini <trini@konsulko.com>
---
 env/env.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/env/env.c b/env/env.c
index bcc189e14db..999c2031c40 100644
--- a/env/env.c
+++ b/env/env.c
@@ -355,6 +355,18 @@ int env_select(const char *name)
 	int prio;
 	bool found = false;
 
+	if (!name) {
+		printf("Available Environment targets:\n");
+		for (prio = 0; (drv = env_driver_lookup(ENVOP_INIT, prio)); prio++) {
+			if (gd->env_load_prio == prio)
+				printf("* ");
+			else
+				printf("  ");
+			printf("%s\n", drv->name);
+		}
+		return 0;
+	}
+
 	printf("Select Environment on %s: ", name);
 
 	/* search ENV driver by name */
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-20 18:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-20 10:32 [PATCH] cmd: env: select: Add output for available evironment targets Christoph Niedermaier
2025-03-20 11:55 ` Marek Vasut
2025-03-20 18:05   ` Christoph Niedermaier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox