All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Simon Glass <sjg@chromium.org>
Cc: u-boot@lists.denx.de, "Sean Anderson" <seanga2@gmail.com>,
	"Andrew Goodbody" <andrew.goodbody@linaro.org>,
	"Benoît Thébaudeau" <benoit.thebaudeau@advansee.com>,
	"Casey Connolly" <casey.connolly@linaro.org>,
	"Daniel Palmer" <daniel@thingy.jp>,
	"Heiko Schocher" <hs@nabladev.com>,
	"Heinrich Schuchardt" <xypron.glpk@gmx.de>,
	"Hugo Villeneuve" <hvilleneuve@dimonoff.com>,
	"Ilias Apalodimas" <ilias.apalodimas@linaro.org>,
	"Jerome Forissier" <jerome.forissier@arm.com>,
	"Joe Hershberger" <joe.hershberger@ni.com>,
	"Kory Maincent (TI.com)" <kory.maincent@bootlin.com>,
	"Marek Vasut" <marek.vasut+renesas@mailbox.org>,
	"Mattijs Korpershoek" <mkorpershoek@kernel.org>,
	"Michal Simek" <michal.simek@amd.com>,
	"Mikhail Kshevetskiy" <mikhail.kshevetskiy@iopsys.eu>,
	"Patrice Chotard" <patrice.chotard@foss.st.com>,
	"Peng Fan" <peng.fan@nxp.com>,
	"Peter Robinson" <pbrobinson@gmail.com>,
	"Quentin Schulz" <quentin.schulz@cherry.de>,
	"Varadarajan Narayanan" <varadarajan.narayanan@oss.qualcomm.com>,
	"Yao Zi" <me@ziyao.cc>
Subject: Re: [RFC PATCH 00/11] Tidy command option parsing and use it a bit
Date: Fri, 15 May 2026 15:43:05 -0600	[thread overview]
Message-ID: <20260515214305.GL1858239@bill-the-cat> (raw)
In-Reply-To: <20260515203311.2555651-1-sjg@chromium.org>

[-- Attachment #1: Type: text/plain, Size: 1147 bytes --]

On Fri, May 15, 2026 at 02:32:51PM -0600, Simon Glass wrote:

> We have had getopt() for over five years but it is not much used. It is
> much easier to understand arg-parsing using getopt() and it avoids
> common errors. As the named maintainer I decided to look at how to make
> more use of it.
> 
> So this series explores the impact of converting a few commands to use
> getopt() instead of ad-hoc parsing. It updates getopt() to handle flags
> anywhere in the cmdline and provides a few helpers to reduce
> boilerplate.
> 
> The chosen commands are:
> 
> - echo: very simple with no flags
> - hash: fairly simple with just one flag
> - env grep/export/import - fuller examples
> 
> The series also adds a recommendation to use getopt() for new commands.
> 
> To try to reduce the code-size increase, a lower-case function is added
> and called from a few places. The difference is fairly marginal.
> 
> Overall, the result is not pretty (see below) with about a 1.1K size
> increase on arm64:

I think that means this is a no-go, and you need to work out what might
lead to a much smaller growth here.

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  parent reply	other threads:[~2026-05-15 21:43 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-15 20:32 [RFC PATCH 00/11] Tidy command option parsing and use it a bit Simon Glass
2026-05-15 20:32 ` [RFC PATCH 01/11] lib: string: Add strlower() Simon Glass
2026-05-15 20:32 ` [RFC PATCH 02/11] cmd: ini: Use strlower() to normalise case Simon Glass
2026-05-15 20:32 ` [RFC PATCH 03/11] fs: fat: " Simon Glass
2026-05-15 20:32 ` [RFC PATCH 04/11] boot: pxe_utils: Use strlower() in get_string() Simon Glass
2026-05-15 20:32 ` [RFC PATCH 05/11] lib: getopt: Permute by default with inline reorder Simon Glass
2026-05-15 21:37   ` Sean Anderson
2026-05-15 20:32 ` [RFC PATCH 06/11] lib: getopt: Add getopt_pop() helper Simon Glass
2026-05-15 21:40   ` Sean Anderson
2026-05-15 20:32 ` [RFC PATCH 07/11] cmd: echo: Use getopt() with '+' prefix for option parsing Simon Glass
2026-05-15 21:58   ` Sean Anderson
2026-05-15 20:32 ` [RFC PATCH 08/11] cmd: hash: Use getopt() " Simon Glass
2026-05-15 20:33 ` [RFC PATCH 09/11] cmd: nvedit: Use getopt() in env grep Simon Glass
2026-05-15 20:33 ` [RFC PATCH 10/11] cmd: nvedit: Use getopt() in env export and env import Simon Glass
2026-05-15 20:33 ` [RFC PATCH 11/11] doc: commands: Recommend getopt() for option parsing Simon Glass
2026-05-15 21:43 ` Tom Rini [this message]
2026-05-15 21:59   ` [RFC PATCH 00/11] Tidy command option parsing and use it a bit Sean Anderson
2026-05-15 22:06     ` Sean Anderson
2026-05-15 22:21       ` Tom Rini
2026-05-15 22:27         ` Sean Anderson

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=20260515214305.GL1858239@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=andrew.goodbody@linaro.org \
    --cc=benoit.thebaudeau@advansee.com \
    --cc=casey.connolly@linaro.org \
    --cc=daniel@thingy.jp \
    --cc=hs@nabladev.com \
    --cc=hvilleneuve@dimonoff.com \
    --cc=ilias.apalodimas@linaro.org \
    --cc=jerome.forissier@arm.com \
    --cc=joe.hershberger@ni.com \
    --cc=kory.maincent@bootlin.com \
    --cc=marek.vasut+renesas@mailbox.org \
    --cc=me@ziyao.cc \
    --cc=michal.simek@amd.com \
    --cc=mikhail.kshevetskiy@iopsys.eu \
    --cc=mkorpershoek@kernel.org \
    --cc=patrice.chotard@foss.st.com \
    --cc=pbrobinson@gmail.com \
    --cc=peng.fan@nxp.com \
    --cc=quentin.schulz@cherry.de \
    --cc=seanga2@gmail.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=varadarajan.narayanan@oss.qualcomm.com \
    --cc=xypron.glpk@gmx.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.