diff options
author | Bill Richardson <wfrichar@chromium.org> | 2014-09-23 11:47:40 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-09-24 00:59:02 +0000 |
commit | 779796f57e1e0236ea502248ede2cbea986fca21 (patch) | |
tree | ccb33230dec19efa3d9e93888b875e70276f1db6 /futility/futility.h | |
parent | 0f07867e6fe186ea460afd557e830c1e49f1ff85 (diff) | |
download | vboot-779796f57e1e0236ea502248ede2cbea986fca21.tar.gz |
futility: Improve help messagesstabilize-6297.B
This provides help messages for the futility commands similar to
the way git does. These show the available commands:
futility
futility help
futility --help
While these show help for a specific command:
futility help COMMAND
futility --help COMMAND
futility COMMAND --help
BUG=none
BRANCH=ToT
TEST=manual
make runtests
And manually look at help messages for each command.
Change-Id: I1126471e242784c6ca7a2f11694fa7c505d833e8
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/219528
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'futility/futility.h')
-rw-r--r-- | futility/futility.h | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/futility/futility.h b/futility/futility.h index 03b4cb57..18261710 100644 --- a/futility/futility.h +++ b/futility/futility.h @@ -18,21 +18,17 @@ struct futil_cmd_t { const char *const name; int (*const handler) (int argc, char **argv); const char *const shorthelp; + void (*longhelp) (const char *cmd); }; -/* - * Macro to define a command. - * - * This defines the struct, then puts a pointer to it in a separate section. - * We'll have a linker script to gather the pointers up later, so we can refer - * to them without explictly declaring every function in a header somewhere. - */ -#define DECLARE_FUTIL_COMMAND(NAME, HANDLER, SHORTHELP) \ - const struct futil_cmd_t __cmd_##NAME = { \ - .name = #NAME, \ - .handler = HANDLER, \ - .shorthelp = SHORTHELP \ - }; +/* Macro to define a command */ +#define DECLARE_FUTIL_COMMAND(NAME, HANDLER, SHORTHELP, LONGHELP) \ + const struct futil_cmd_t __cmd_##NAME = { \ + .name = #NAME, \ + .handler = HANDLER, \ + .shorthelp = SHORTHELP, \ + .longhelp = LONGHELP, \ + } /* This is the list of pointers to all commands. */ extern const struct futil_cmd_t *const futil_cmds[]; @@ -45,8 +41,8 @@ extern const struct futil_cmd_t *const futil_cmds[]; /* Test an important condition at compile time, not run time */ #ifndef BUILD_ASSERT #define _BA1_(cond, line) \ - extern int __build_assertion_ ## line[1 - 2*!(cond)] \ - __attribute__ ((unused)) + extern int __build_assertion_ ## line[1 - 2*!(cond)] \ + __attribute__ ((unused)) #define _BA0_(c, x) _BA1_(c, x) #define BUILD_ASSERT(cond) _BA0_(cond, __LINE__) #endif |