blob: ca08f07c118a973988a1c966b97cc06da630f1e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#include <stdio.h>
#include <string.h>
#include "common.h"
void print_help(const struct Command* commands, const size_t size)
{
int longestCommand = 0;
for (size_t i = 0; i < size; ++i)
{
int commandLength = strlen(commands[i].name);
if (commandLength > longestCommand) longestCommand = commandLength;
}
for (size_t i = 0; i < size; ++i)
{
printf("\t%-*s\t %s\n", longestCommand, commands[i].name, commands[i].description);
}
}
|