From: Boris Brezillon <boris.brezillon@bootlin.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [RFC PATCH 0/4] cmd: Simplify support for sub-commands
Date: Sun, 18 Nov 2018 23:30:44 +0100 [thread overview]
Message-ID: <20181118233044.2b920380@bbrezillon> (raw)
In-Reply-To: <20181116223812.28589-1-boris.brezillon@bootlin.com>
+Tom, Marek as I realize I only sent this to the ML, and I'm actually
expecting feedback from maintainers. Let me know if you think I should
Cc other people.
On Fri, 16 Nov 2018 23:38:08 +0100
Boris Brezillon <boris.brezillon@bootlin.com> wrote:
> Hello,
>
> This patch series aims at simplifying the command parsing logic done in
> pretty much all the cmd/foo.c files by adding a few macros that help
> defining sub-commands attach to the main entry point.
For those who are interested, I started converting some uboot cmds to
this approach [1]. Most of them are easily converted (I'd say 3/4 or
the existing U_BOOT_CMD_MKENT() users), the remaining ones need extra
care. But before I even consider sending a v2 (possibly including
those conversion patches), I'd like to have some feedback on the general
approach (whether it's something u-boot maintainers are interested in
or not).
Thanks,
Boris
>
> When you use those macros you also get sub-command auto-completion for
> free (the rest of the auto-completion still has to be done manually).
>
> Support for several levels of sub commands is not supported but can
> easily be added if needed.
>
> Some details about the patches:
>
> - Patch 1 is a fix for the auto-completion code that I had to do have
> auto-completion in the mtd command working correctly (I can submit it
> separately if needed)
> - Patch 2 is exposing a function to ease support of auto-completion of
> sub-commands
> - Patch 3 is adding a set of macros to easily declare the sub-commands
> attached to the main command
> - Patch 4 is making use of this new infrastructure in cmd/mtd.c.
>
> Regards,
>
> Boris
>
> Boris Brezillon (4):
> common: command: Fix command auto-completion
> common: command: Expose a generic helper to auto-complete sub commands
> command: commands: Add macros to declare commands with subcmds
> cmd: mtd: Use the subcmd infrastructure to declare mtd sub-commands
>
> cmd/mtd.c | 475 +++++++++++++++++++++++++++-------------------
> common/command.c | 32 +++-
> include/command.h | 54 ++++++
> 3 files changed, 360 insertions(+), 201 deletions(-)
>
[1]https://github.com/bbrezillon/u-boot/commits/sub-cmds
prev parent reply other threads:[~2018-11-18 22:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-16 22:38 [U-Boot] [RFC PATCH 0/4] cmd: Simplify support for sub-commands Boris Brezillon
2018-11-16 22:38 ` [U-Boot] [RFC PATCH 1/4] common: command: Fix command auto-completion Boris Brezillon
2018-11-16 22:38 ` [U-Boot] [RFC PATCH 2/4] common: command: Expose a generic helper to auto-complete sub commands Boris Brezillon
2018-11-16 22:38 ` [U-Boot] [RFC PATCH 3/4] command: commands: Add macros to declare commands with subcmds Boris Brezillon
2018-11-16 22:38 ` [U-Boot] [RFC PATCH 4/4] cmd: mtd: Use the subcmd infrastructure to declare mtd sub-commands Boris Brezillon
2018-11-18 22:30 ` Boris Brezillon [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=20181118233044.2b920380@bbrezillon \
--to=boris.brezillon@bootlin.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