From: Christoph Niedermaier <cniedermaier@dh-electronics.com>
To: Marek Vasut <marex@denx.de>,
"u-boot@lists.denx.de" <u-boot@lists.denx.de>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>,
Joe Hershberger <joe.hershberger@ni.com>,
Tom Rini <trini@konsulko.com>, Simon Glass <sjg@chromium.org>
Subject: RE: [PATCH V2] cmd: env: select: Add output for available evironment targets
Date: Wed, 26 Mar 2025 16:02:54 +0000 [thread overview]
Message-ID: <8a6f66eb182744a3b6d53dfb62623ed8@dh-electronics.com> (raw)
In-Reply-To: <1fac6372-b251-4778-b3fe-7f7eda3aac8f@denx.de>
From: Marek Vasut <marex@denx.de>
Sent: Friday, March 21, 2025 8:23 PM
> On 3/21/25 7:43 PM, Christoph Niedermaier wrote:
>> Add parameter "-l" for printing available environment targets. The
>> active target is marked with an asterisk. This is done by adding
>> the function env_select_print_list().
>>
>> If "env select" is called without a target parameter the result is
>> "Select Environment on <NULL>: driver not found". Replace this not
>> so useful output by showing the env usage message instead.
>>
>> 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>
>> ---
>> V2: - Showing available environment targets by parameter "-l"
>> - Showing env usage message if env select is called without a target
>> ---
>> cmd/nvedit.c | 19 ++++++++++++++++++-
>> env/env.c | 16 ++++++++++++++++
>> include/env.h | 7 +++++++
>> 3 files changed, 41 insertions(+), 1 deletion(-)
>>
>> diff --git a/cmd/nvedit.c b/cmd/nvedit.c
>> index 1f259801293..de64094db4d 100644
>> --- a/cmd/nvedit.c
>> +++ b/cmd/nvedit.c
>> @@ -499,6 +499,23 @@ static int do_env_load(struct cmd_tbl *cmdtp, int flag, int argc,
>> static int do_env_select(struct cmd_tbl *cmdtp, int flag, int argc,
>> char *const argv[])
>> {
>> + if (!argv[1])
>> + return CMD_RET_USAGE;
>> +
>> + while (argc > 1 && **(argv + 1) == '-') {
> Two higher level things:
>
> - Can you first convert cmd/nvedit.h to use include/getopt.h and then
> use getopt() here too ? This hand rolled arg parsing is repulsive,
> the multiple ad-hoc copies of that are even worse.
I will try.
> - Please write a test for this, see test/cmd/ , maybe Simon can help
> with details of this ... ?
I will try.
Regards
Christoph
prev parent reply other threads:[~2025-03-26 16:24 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-21 18:43 [PATCH V2] cmd: env: select: Add output for available evironment targets Christoph Niedermaier
2025-03-21 19:22 ` Marek Vasut
2025-03-26 16:02 ` Christoph Niedermaier [this message]
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=8a6f66eb182744a3b6d53dfb62623ed8@dh-electronics.com \
--to=cniedermaier@dh-electronics.com \
--cc=joe.hershberger@ni.com \
--cc=marex@denx.de \
--cc=patrick.delaunay@foss.st.com \
--cc=sjg@chromium.org \
--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