summaryrefslogtreecommitdiffstats
path: root/commands/help.c
diff options
context:
space:
mode:
authorCarlo Caione <carlo.caione@gmail.com>2012-10-12 00:14:29 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-10-12 10:52:53 +0200
commit27b77dc415a941b6e13b940b8b124bdaeb7bfeba (patch)
tree27ae1681fe9521e0bd854425600f41cc1d5704c1 /commands/help.c
parente5a8c1e2324acde9740ae28febf24ec8634f9448 (diff)
downloadbarebox-27b77dc415a941b6e13b940b8b124bdaeb7bfeba.tar.gz
cosmetic: improve command list display
Following from the Frank Jullien's patch, here is the same cosmetic correction when the list of commands is printed (the problem was that the commands for gpio_* were too long for the %10s alignment) Signed-off-by: Carlo Caione <carlo.caione@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands/help.c')
-rw-r--r--commands/help.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/commands/help.c b/commands/help.c
index 72b0bef..a12d9c3 100644
--- a/commands/help.c
+++ b/commands/help.c
@@ -28,12 +28,17 @@
static int do_help(int argc, char *argv[])
{
struct command *cmdtp;
+ int max_length = 0;
if (argc == 1) { /* show list of commands */
+ for_each_command(cmdtp)
+ if(strlen(cmdtp->name) > max_length)
+ max_length = strlen(cmdtp->name);
+
for_each_command(cmdtp) {
if (!cmdtp->usage)
continue;
- printf("%10s - %s\n", cmdtp->name, cmdtp->usage);
+ printf("%*s - %s\n", max_length, cmdtp->name, cmdtp->usage);
}
return 0;
}