aboutsummaryrefslogtreecommitdiff
path: root/main.c
blob: 6d382abecb2f0d12031fe3b238f111db453c68f0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "commands.h"
#include "utils/fs.h"

int main(int argc, char *argv[]) {
    create_necessary_directories();

    // start first command if no arguments provided
    if (argc < 2)
        return commands[0].handler(argc, argv);

    for (size_t i = 0; i < commands_count; i++) {
        if (is_command(commands[i], argv[1]))
            return commands[i].handler(argc, argv);
    }

    command_not_recognized(argv[0]);
    return 1;
}