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 <[email protected]> Cc: Marek Vasut <[email protected]> Cc: Patrick Delaunay <[email protected]> Cc: Joe Hershberger <[email protected]> Cc: Tom Rini <[email protected]> --- 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

