cmd: env: select: Add output for available evironment targets
PATCH 1/1 cmd: env: select: Add output for available evironment targets
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.
--- env/env.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
env/env.c +12 -0
@@ -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 */
Signature · 1 line
2.30.2
Quoted 2 lines · Christoph Niedermaier
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 ?
Quoted 3 lines
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' .
From: Marek Vasut <[email protected]>
Sent: Thursday, March 20, 2025 12:56 PM
Quoted 5 lines · Christoph Niedermaier
Quoted 2 lines
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.
Quoted 7 lines
Quoted 3 lines
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.cdo_env_select()and implement some 'env select -l' .
I could do this in v2.
Regards
Christoph