cmd: env: Add `indirect` to indirectly set values
authorSamuel Dionne-Riel <samuel@dionne-riel.com>
Mon, 20 Dec 2021 23:31:56 +0000 (18:31 -0500)
committerTom Rini <trini@konsulko.com>
Thu, 7 Apr 2022 20:50:42 +0000 (16:50 -0400)
commitec57bd745470fc47b278c21d2eebc95c27c442e5
treeb8112d9b6b585183d99afcb49b0557f278e3b206
parent8d61237edbf6314a701cf78da2c5893a73ff5438
cmd: env: Add `indirect` to indirectly set values

This allows an ergonomic-enough approximation of ${!variable} expansion.
This could be used the following way:

```
for target in ${boot_targets}; do
   env indirect target_name target_name_${target}
   # ...
done
```

Assuming `target_name_mmc0` and similar are set appropriately.

A default value can be optionally provided.

Note: this acts on environment variables, not hush variables.

Signed-off-by: Samuel Dionne-Riel <samuel@dionne-riel.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: "Marek BehĂșn" <marek.behun@nic.cz>
[trini: Don't enable by default]
cmd/Kconfig
cmd/nvedit.c