9
0
Fork 0

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>
This commit is contained in:
Carlo Caione 2012-10-12 00:14:29 +02:00 committed by Sascha Hauer
parent e5a8c1e232
commit 27b77dc415
1 changed files with 6 additions and 1 deletions

View File

@ -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;
}