Global: refactor code of -h <module>-format

This commit is contained in:
李通洲
2024-12-11 10:47:02 +08:00
parent e45ff546ed
commit 9a36d63d18
78 changed files with 1454 additions and 1872 deletions
+15 -11
View File
@@ -178,19 +178,23 @@ void ffGenerateSeparatorJsonConfig(FFSeparatorOptions* options, yyjson_mut_doc*
yyjson_mut_obj_add_strbuf(doc, module, "string", &options->string);
}
static FFModuleBaseInfo ffModuleInfo = {
.name = FF_SEPARATOR_MODULE_NAME,
.description = "Print a separator line",
.parseCommandOptions = (void*) ffParseSeparatorCommandOptions,
.parseJsonObject = (void*) ffParseSeparatorJsonObject,
.printModule = (void*) ffPrintSeparator,
.generateJsonConfig = (void*) ffGenerateSeparatorJsonConfig,
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
{"Separator string", "string"},
{"Output color", "outputColor"},
{"Length", "length"},
}))
};
void ffInitSeparatorOptions(FFSeparatorOptions* options)
{
ffOptionInitModuleBaseInfo(
&options->moduleInfo,
FF_SEPARATOR_MODULE_NAME,
"Print a separator line",
ffParseSeparatorCommandOptions,
ffParseSeparatorJsonObject,
ffPrintSeparator,
NULL,
NULL,
ffGenerateSeparatorJsonConfig
);
options->moduleInfo = ffModuleInfo;
ffStrbufInitStatic(&options->string, "-");
ffStrbufInit(&options->outputColor);
options->length = 0;