mirror of
https://github.com/ipxe/ipxe
synced 2026-03-16 03:02:07 +03:00
Print multiple commands per line in help
This commit is contained in:
@@ -62,12 +62,22 @@ struct command exit_command __command = {
|
|||||||
/** "help" command body */
|
/** "help" command body */
|
||||||
static int help_exec ( int argc __unused, char **argv __unused ) {
|
static int help_exec ( int argc __unused, char **argv __unused ) {
|
||||||
struct command *command;
|
struct command *command;
|
||||||
|
unsigned int hpos = 0;
|
||||||
|
|
||||||
printf ( "\nAvailable commands:\n\n" );
|
printf ( "\nAvailable commands:\n\n" );
|
||||||
for ( command = commands ; command < commands_end ; command++ ) {
|
for ( command = commands ; command < commands_end ; command++ ) {
|
||||||
printf ( " %s\n", command->name );
|
hpos += printf ( " %s", command->name );
|
||||||
|
if ( hpos > ( 16 * 4 ) ) {
|
||||||
|
printf ( "\n" );
|
||||||
|
hpos = 0;
|
||||||
|
} else {
|
||||||
|
while ( hpos % 16 ) {
|
||||||
|
printf ( " " );
|
||||||
|
hpos++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
printf ( "\nType \"<command> --help\" for further information\n\n" );
|
printf ( "\n\nType \"<command> --help\" for further information\n\n" );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user