summaryrefslogtreecommitdiffstats
path: root/src/modules/break/break.c
blob: e560e18a6ba1343228656f3778fe6d2cbaca9237 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "common/printing.h"
#include "logo/logo.h"
#include "modules/break/break.h"

bool ffPrintBreak(FF_A_UNUSED FFBreakOptions* options) {
    ffLogoPrintLine();
    putchar('\n');
    return true;
}

void ffParseBreakJsonObject(FF_A_UNUSED FFBreakOptions* options, FF_A_UNUSED yyjson_val* module) {
    yyjson_val *key, *val;
    size_t idx, max;
    yyjson_obj_foreach (module, idx, max, key, val) {
        if (unsafe_yyjson_equals_str(key, "type") || unsafe_yyjson_equals_str(key, "condition")) {
            continue;
        }

        ffPrintError(FF_BREAK_MODULE_NAME, 0, NULL, FF_PRINT_TYPE_NO_CUSTOM_KEY, "Unknown JSON key %s", unsafe_yyjson_get_str(key));
    }
}

void ffInitBreakOptions(FF_A_UNUSED FFBreakOptions* options) {
}

void ffDestroyBreakOptions(FF_A_UNUSED FFBreakOptions* options) {
}

FFModuleBaseInfo ffBreakModuleInfo = {
    .name = FF_BREAK_MODULE_NAME,
    .description = "Print an empty line",
    .initOptions = (void*) ffInitBreakOptions,
    .destroyOptions = (void*) ffDestroyBreakOptions,
    .parseJsonObject = (void*) ffParseBreakJsonObject,
    .printModule = (void*) ffPrintBreak,
};