From: Christoph Niedermaier <cniedermaier@dh-electronics.com>
To: <u-boot@lists.denx.de>
Cc: Christoph Niedermaier <cniedermaier@dh-electronics.com>,
Marek Vasut <marex@denx.de>,
Patrick Delaunay <patrick.delaunay@foss.st.com>,
Joe Hershberger <joe.hershberger@ni.com>,
Tom Rini <trini@konsulko.com>
Subject: [PATCH] cmd: env: select: Add output for available evironment targets
Date: Thu, 20 Mar 2025 11:32:57 +0100 [thread overview]
Message-ID: <20250320103257.14185-1-cniedermaier@dh-electronics.com> (raw)
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
next reply other threads:[~2025-03-20 10:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-20 10:32 Christoph Niedermaier [this message]
2025-03-20 11:55 ` [PATCH] cmd: env: select: Add output for available evironment targets Marek Vasut
2025-03-20 18:05 ` Christoph Niedermaier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250320103257.14185-1-cniedermaier@dh-electronics.com \
--to=cniedermaier@dh-electronics.com \
--cc=joe.hershberger@ni.com \
--cc=marex@denx.de \
--cc=patrick.delaunay@foss.st.com \
--cc=trini@konsulko.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox