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/cmd_dump_kernel_config.c | |
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/cmd_dump_kernel_config.c')
-rw-r--r-- | futility/cmd_dump_kernel_config.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/futility/cmd_dump_kernel_config.c b/futility/cmd_dump_kernel_config.c index 1bf411b2..520d2802 100644 --- a/futility/cmd_dump_kernel_config.c +++ b/futility/cmd_dump_kernel_config.c @@ -23,13 +23,10 @@ static const struct option long_opts[] = { }; /* Print help and return error */ -static int PrintHelp(void) +static void PrintHelp(const char *progname) { - puts("dump_kernel_config - Prints the kernel command line\n" - "\n" - "Usage: dump_kernel_config [--kloadaddr <ADDRESS>] " - "<image/blockdevice>\n" "\n" ""); - return 1; + printf("\nUsage: " MYNAME " %s [--kloadaddr ADDRESS] " + "KERNEL_PARTITION\n\n", progname); } static int do_dump_kernel_config(int argc, char *argv[]) @@ -70,8 +67,10 @@ static int do_dump_kernel_config(int argc, char *argv[]) } else infile = argv[optind]; - if (parse_error) - return PrintHelp(); + if (parse_error) { + PrintHelp(argv[0]); + return 1; + } if (!infile || !*infile) { fprintf(stderr, "Must specify filename\n"); @@ -89,4 +88,5 @@ static int do_dump_kernel_config(int argc, char *argv[]) } DECLARE_FUTIL_COMMAND(dump_kernel_config, do_dump_kernel_config, - "Prints the kernel command line"); + "Prints the kernel command line", + PrintHelp); |