Global: support for named format arguments

Fix #796
This commit is contained in:
Carter Li
2024-05-27 16:41:37 +08:00
parent 965777323e
commit c8451cab52
65 changed files with 855 additions and 806 deletions
+8 -8
View File
@@ -50,10 +50,10 @@ static void printDevice(FFSoundOptions* options, const FFSoundDevice* device, ui
ffPercentAppendNum(&percentageStr, device->volume, options->percent, false, &options->moduleArgs);
FF_PRINT_FORMAT_CHECKED(FF_SOUND_MODULE_NAME, index, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_SOUND_NUM_FORMAT_ARGS, ((FFformatarg[]) {
{FF_FORMAT_ARG_TYPE_BOOL, &device->main},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->name},
{FF_FORMAT_ARG_TYPE_STRBUF, &percentageStr},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->identifier}
{FF_FORMAT_ARG_TYPE_BOOL, &device->main, "is-main"},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->name, "name"},
{FF_FORMAT_ARG_TYPE_STRBUF, &percentageStr, "volume-percentage"},
{FF_FORMAT_ARG_TYPE_STRBUF, &device->identifier, "identifier"},
}));
}
}
@@ -226,10 +226,10 @@ void ffGenerateSoundJsonResult(FF_MAYBE_UNUSED FFSoundOptions* options, yyjson_m
void ffPrintSoundHelpFormat(void)
{
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_SOUND_MODULE_NAME, "{2} ({3}%)", FF_SOUND_NUM_FORMAT_ARGS, ((const char* []) {
"Is main sound device",
"Device name",
"Volume",
"Identifier"
"Is main sound device - is-main",
"Device name - name",
"Volume (in percentage) - volume-percentage",
"Identifier - identifier",
}));
}