
On Thu, 29 Nov 2018 00:39:15 +0100 Boris Brezillon boris.brezillon@bootlin.com wrote:
Hello,
Here is the 2nd version of the sub-cmd patchset. This version simplifies the sub-cmd declaration syntax and allows per sub-cmd maxargs and repeatable check.
I also added a patch showing how simple it is to convert an existing command to this infrastructure. I converting a bunch of other cmds [1] but I keep that for later, as I don't want to scare reviewers with a 20+ patch series.
Noticed a few typos in my commit messages. I'll fix them up in a v3 unless the person in charge of the common/cmd dirs want to fix them when applying the patches.
Let me know if you want me to send the patches converting other cmds (see [1)] to this infrastructure.
Regards,
Boris
[1]https://github.com/bbrezillon/u-boot/commits/sub-cmds
Changes since v1:
- Drop a few params in the subcmd macro def
- Get repeatable and maxargs info from the subcmd instead of the main one
- Convert the adc command
Boris Brezillon (6): common: command: Fix command auto-completion common: command: Expose a generic helper to auto-complete sub commands common: command: Rework the 'cmd is repeatable' logic command: commands: Add macros to declare commands with subcmds cmd: mtd: Use the subcmd infrastructure to declare mtd sub-commands cmd: adc: Use the sub-command infrastructure
cmd/adc.c | 31 +-- cmd/dtimg.c | 2 +- cmd/help.c | 2 +- cmd/mmc.c | 4 +- cmd/mtd.c | 476 +++++++++++++++++++++++++++------------------- common/command.c | 68 ++++++- include/command.h | 133 ++++++++++++- 7 files changed, 476 insertions(+), 240 deletions(-)