blob: f3131e03bc5c6954f06c566909370f4062384e73 (
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);
}
}
|