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
+16 -1
View File
@@ -47,7 +47,7 @@ void ffPrintVersion(FFVersionOptions* options)
void ffInitVersionOptions(FFVersionOptions* options)
{
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_VERSION_MODULE_NAME, ffParseVersionCommandOptions, ffParseVersionJsonObject, ffPrintVersion, ffGenerateVersionJson);
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_VERSION_MODULE_NAME, ffParseVersionCommandOptions, ffParseVersionJsonObject, ffPrintVersion, ffGenerateVersionJson, ffPrintVersionHelpFormat);
ffOptionInitModuleArg(&options->moduleArgs);
}
@@ -114,3 +114,18 @@ void ffGenerateVersionJson(FF_MAYBE_UNUSED FFVersionOptions* options, yyjson_mut
yyjson_mut_obj_add_strbuf(doc, obj, "libc", &buf);
}
}
void ffPrintVersionHelpFormat(void)
{
ffPrintModuleFormatHelp(FF_VERSION_MODULE_NAME, "{1} {2}{3} ({5})", FF_VERSION_NUM_FORMAT_ARGS, (const char* []) {
"Project name",
"Version",
"Version tweak",
"Build type (debug or release)",
"Architecture",
"CMake build type (Debug, Release, RelWithDebInfo, MinSizeRel)",
"Date time when compiling",
"Compiler used",
"Libc used"
});
}
+1
View File
@@ -10,3 +10,4 @@ bool ffParseVersionCommandOptions(FFVersionOptions* options, const char* key, co
void ffDestroyVersionOptions(FFVersionOptions* options);
void ffParseVersionJsonObject(FFVersionOptions* options, yyjson_val* module);
void ffGenerateVersionJson(FFVersionOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
void ffPrintVersionHelpFormat(void);