diff options
author | Holger Schurig <holgerschurig@gmail.com> | 2014-05-13 10:28:42 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2014-05-14 10:03:43 +0200 |
commit | f1f532084a6e9ee8225f047353999b459455df7e (patch) | |
tree | f2b8b1f25c5c630209c6970e3a7ce57a3d55d367 /commands/ubiformat.c | |
parent | ab23d0bb3f66cfb7a97a8aa6b8007687ed7a6925 (diff) | |
download | barebox-f1f532084a6e9ee8225f047353999b459455df7e.tar.gz barebox-f1f532084a6e9ee8225f047353999b459455df7e.tar.xz |
commands: harmonize in-barebox documentation
This patch does probably too much, but it's hard (and very
cumbersome/time consuming) to break it out. What is does is this:
* each command has one short description, e.g. "list MUX configuration"
* made sure the short descriptions start lowercase
* each command has one usage. That string contains just the
options, e.g. "[-npn]". It's not part of the long help text.
* that is, it doesn't say "[OPTIONS]" anymore, every usable option
is listed by character in this (short) option string (the long
description is in the long help text, as before)
* help texts have been reworked, to make them
- sometimes smaller
- sometimes describe the options better
- more often present themselves in a nicer format
* all long help texts are now created with BUSYBOX_CMD_HELP_
macros, no more 'static const __maybe_unused char cmd_foobar_help[]'
* made sure the long help texts starts uppercase
* because cmdtp->name and cmdtp->opts together provide the new usage,
all "Usage: foobar" texts have been removed from the long help texts
* BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this
is nicer in the source code
* BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself
* made sure no line gets longer than 77 characters
* delibertely renamed cmdtp->usage, so that we can get compile-time
errors (e.g. in out-of-tree modules that use register_command()
* the 'help' command can now always emit the usage, even without
compiled long help texts
* 'help -v' gives a list of commands with their short description, this
is similar like the old "help" command before my patchset
* 'help -a' gives out help of all commands
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/ubiformat.c')
-rw-r--r-- | commands/ubiformat.c | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/commands/ubiformat.c b/commands/ubiformat.c index 98e8c52d11..5c8a363439 100644 --- a/commands/ubiformat.c +++ b/commands/ubiformat.c @@ -764,35 +764,32 @@ out_close_mtd: } BAREBOX_CMD_HELP_START(ubiformat) -BAREBOX_CMD_HELP_USAGE(PROGRAM_NAME " <MTD device file name> [-s <bytes>] [-O <offs>] [-n]\n" - "\t[-f <file>] [-e <value>] [-x <num>] [-Q <num>] [-y] [-q] [-v]\n") -BAREBOX_CMD_HELP_SHORT("A tool to format MTD devices and flash UBI images\n") -BAREBOX_CMD_HELP_OPT("-s <bytes>", "minimum input/output unit used for UBI headers, " -"e.g. sub-page size in case of NAND flash (equivalent to the minimum input/output " -"unit size by default)\n") -BAREBOX_CMD_HELP_OPT("-O <offs>", "offset if the VID header from start of the " -"physical eraseblock (default is the next minimum I/O unit or sub-page after the EC " -"header)\n") -BAREBOX_CMD_HELP_OPT("-n", "only erase all eraseblock and preserve erase " -"counters, do not write empty volume table\n") -BAREBOX_CMD_HELP_OPT("-f <file>", "flash image file\n") -BAREBOX_CMD_HELP_OPT("-e <value>", "use <value> as the erase counter value for all eraseblocks\n") -BAREBOX_CMD_HELP_OPT("-x <num>", "UBI version number to put to EC headers " -"(default is 1)\n") -BAREBOX_CMD_HELP_OPT("-Q <num>", "32-bit UBI image sequence number to use " -"(by default a random number is picked)\n") -BAREBOX_CMD_HELP_OPT("-q", "suppress progress percentage information\n") -BAREBOX_CMD_HELP_OPT("-v", "be verbose\n") -BAREBOX_CMD_HELP_TEXT( -"Example 1: " PROGRAM_NAME " /dev/nand0 -y - format nand0 and assume yes\n" -"Example 2: " PROGRAM_NAME " /dev/nand0 -q -e 0 - format nand0,\n" -" be quiet and force erase counter value 0.\n"; -) +BAREBOX_CMD_HELP_TEXT("A tool to format MTD devices and flash UBI images") +BAREBOX_CMD_HELP_TEXT("") +BAREBOX_CMD_HELP_TEXT("Options:") +BAREBOX_CMD_HELP_OPT("-s BYTES", "minimum input/output unit used for UBI headers") +BAREBOX_CMD_HELP_OPT("\t", "e.g. sub-page size in case of NAND flash") +BAREBOX_CMD_HELP_OPT("-O OFFS\t", "offset if the VID header from start of the") +BAREBOX_CMD_HELP_OPT("\t", "physical eraseblock (default is the next minimum I/O unit or") +BAREBOX_CMD_HELP_OPT("\t", "sub-page after the EC header)") +BAREBOX_CMD_HELP_OPT("-n\t", "only erase all eraseblock and preserve erase") +BAREBOX_CMD_HELP_OPT("\t", "counters, do not write empty volume table") +BAREBOX_CMD_HELP_OPT("-f FILE\t", "flash image file") +BAREBOX_CMD_HELP_OPT("-e VALUE", "use VALUE as erase counter value for all eraseblocks") +BAREBOX_CMD_HELP_OPT("-x NUM\t", "UBI version number to put to EC headers (default 1)") +BAREBOX_CMD_HELP_OPT("-Q NUM\t", "32-bit UBI image sequence number to use") +BAREBOX_CMD_HELP_OPT("-q\t", "suppress progress percentage information") +BAREBOX_CMD_HELP_OPT("-v\t", "be verbose") +BAREBOX_CMD_HELP_TEXT("") +BAREBOX_CMD_HELP_TEXT("Example 1: " PROGRAM_NAME " /dev/nand0 -y - format nand0 and assume yes") +BAREBOX_CMD_HELP_TEXT("Example 2: " PROGRAM_NAME " /dev/nand0 -q -e 0 - format nand0,") +BAREBOX_CMD_HELP_TEXT("\tbe quiet and force erase counter value 0.") BAREBOX_CMD_HELP_END BAREBOX_CMD_START(ubiformat) .cmd = do_ubiformat, - .usage = "format an ubi volume", + BAREBOX_CMD_DESC("format an ubi volume") + BAREBOX_CMD_OPTS("[-sOnfexQqv] MTDEVICE") BAREBOX_CMD_GROUP(CMD_GRP_PART) BAREBOX_CMD_HELP(cmd_ubiformat_help) BAREBOX_CMD_END |