diff --git a/common/command.c b/common/command.c index 61191c2..dc2cb88 100644 --- a/common/command.c +++ b/common/command.c @@ -47,6 +47,8 @@ puts(cmdtp->help); putchar('\n'); } + if (cmdtp->usage) + cmdtp->usage(); #endif } EXPORT_SYMBOL(barebox_cmd_usage); diff --git a/include/command.h b/include/command.h index 5d5bf53..3aca1a9 100644 --- a/include/command.h +++ b/include/command.h @@ -54,6 +54,7 @@ uint32_t group; #ifdef CONFIG_LONGHELP const char *help; /* Help message (long) */ + void (*usage)(void); #endif } #ifdef __x86_64__ @@ -115,8 +116,10 @@ #ifdef CONFIG_LONGHELP #define BAREBOX_CMD_HELP(text) .help = text, +#define BAREBOX_CMD_USAGE(fn) .usage = fn, #else #define BAREBOX_CMD_HELP(text) +#define BAREBOX_CMD_USAGE(fn) #endif #define BAREBOX_CMD_GROUP(grp) .group = grp,