Global: support for named format arguments

Fix #796
This commit is contained in:
Carter Li committed 2024-05-28 10:23:29 +08:00
1 parent 965777323e
commit c8451cab52
65 files changed
+855 -806

No files matched your search

+6 -6
View File
@@ -59,9 +59,9 @@ void ffPrintMemory(FFMemoryOptions* options)
FF_STRBUF_AUTO_DESTROY percentageStr = ffStrbufCreate();
ffPercentAppendNum(&percentageStr, percentage, options->percent, false, &options->moduleArgs);
FF_PRINT_FORMAT_CHECKED(FF_MEMORY_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_MEMORY_NUM_FORMAT_ARGS, ((FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &usedPretty},
{FF_FORMAT_ARG_TYPE_STRBUF, &totalPretty},
{FF_FORMAT_ARG_TYPE_STRBUF, &percentageStr},
{FF_FORMAT_ARG_TYPE_STRBUF, &usedPretty, "used"},
{FF_FORMAT_ARG_TYPE_STRBUF, &totalPretty, "total"},
{FF_FORMAT_ARG_TYPE_STRBUF, &percentageStr, "percentage"},
}));
}
}
@@ -128,9 +128,9 @@ void ffGenerateMemoryJsonResult(FF_MAYBE_UNUSED FFMemoryOptions* options, yyjson
void ffPrintMemoryHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_MEMORY_MODULE_NAME, "{1} / {2} ({3})", FF_MEMORY_NUM_FORMAT_ARGS, ((const char* []) {
"Used size",
"Total size",
"Percentage used",
"Used size - used",
"Total size - total",
"Percentage used - percentage",
}));
}