[U-Boot] [RFC PATCH 0/4] cmd: Simplify support for sub-commands

Boris Brezillon boris.brezillon at bootlin.com
Fri Nov 16 22:38:08 UTC 2018


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.

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(-)

-- 
2.17.1



More information about the U-Boot mailing list