* [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
* Re: [PATCH] cmd: env: select: Add output for available evironment targets
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
0 siblings, 1 reply; 3+ messages in thread
From: Marek Vasut @ 2025-03-20 11:55 UTC (permalink / raw)
To: Christoph Niedermaier, u-boot; +Cc: Patrick Delaunay, Joe Hershberger, Tom Rini
On 3/20/25 11:32 AM, Christoph Niedermaier wrote:
> If "env select" is called without a target parameter the result is
> "Select Environment on <NULL>: driver not found".
Why is this not the correct output ?
> Improve the output
> by showing a list of available evironment targets, where the active
> target is marked with an asterisk.
If the goal is to add support for listing available env options for 'env
select' , then better modify cmd/nvedit.c do_env_select() and implement
some 'env select -l' .
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] cmd: env: select: Add output for available evironment targets
2025-03-20 11:55 ` Marek Vasut
@ 2025-03-20 18:05 ` Christoph Niedermaier
0 siblings, 0 replies; 3+ messages in thread
From: Christoph Niedermaier @ 2025-03-20 18:05 UTC (permalink / raw)
To: Marek Vasut
Cc: u-boot@lists.denx.de, Patrick Delaunay, Joe Hershberger, Tom Rini
From: Marek Vasut <marex@denx.de>
Sent: Thursday, March 20, 2025 12:56 PM
> On 3/20/25 11:32 AM, Christoph Niedermaier wrote:
>> If "env select" is called without a target parameter the result is
>> "Select Environment on <NULL>: driver not found".
>
> Why is this not the correct output ?
I think it would be better to print an usage message here.
>> Improve the output
>> by showing a list of available evironment targets, where the active
>> target is marked with an asterisk.
>
> If the goal is to add support for listing available env options for 'env
> select' , then better modify cmd/nvedit.c do_env_select() and implement
> some 'env select -l' .
I could do this in v2.
Regards
Christoph
^ permalink raw reply [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