Global: improve support of --help *-format

Also fix some bugs found when refactoring
This commit is contained in:
李通洲
2023-10-07 13:40:40 +08:00
parent 23d2cc3fdc
commit 12208b2c7c
113 changed files with 746 additions and 557 deletions
+10 -1
View File
@@ -68,7 +68,7 @@ void ffPrintMemory(FFMemoryOptions* options)
void ffInitMemoryOptions(FFMemoryOptions* options)
{
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_MEMORY_MODULE_NAME, ffParseMemoryCommandOptions, ffParseMemoryJsonObject, ffPrintMemory, ffGenerateMemoryJson);
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_MEMORY_MODULE_NAME, ffParseMemoryCommandOptions, ffParseMemoryJsonObject, ffPrintMemory, ffGenerateMemoryJson, ffPrintMemoryHelpFormat);
ffOptionInitModuleArg(&options->moduleArgs);
}
@@ -119,3 +119,12 @@ void ffGenerateMemoryJson(FF_MAYBE_UNUSED FFMemoryOptions* options, yyjson_mut_d
yyjson_mut_obj_add_uint(doc, obj, "total", storage.bytesTotal);
yyjson_mut_obj_add_uint(doc, obj, "used", storage.bytesUsed);
}
void ffPrintMemoryHelpFormat(void)
{
ffPrintModuleFormatHelp(FF_MEMORY_MODULE_NAME, "{1} / {2} ({3})", FF_MEMORY_NUM_FORMAT_ARGS, (const char* []) {
"Used size",
"Total size",
"Percentage used"
});
}