mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 08:13:44 +01:00
Global: refactor code of -h <module>-format
This commit is contained in:
+17
-23
@@ -5,8 +5,6 @@
|
||||
#include "modules/vulkan/vulkan.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_VULKAN_NUM_FORMAT_ARGS 4
|
||||
|
||||
void ffPrintVulkan(FFVulkanOptions* options)
|
||||
{
|
||||
const FFVulkanResult* vulkan = ffDetectVulkan();
|
||||
@@ -43,7 +41,7 @@ void ffPrintVulkan(FFVulkanOptions* options)
|
||||
}
|
||||
else
|
||||
{
|
||||
FF_PRINT_FORMAT_CHECKED(FF_VULKAN_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, FF_VULKAN_NUM_FORMAT_ARGS, ((FFformatarg[]) {
|
||||
FF_PRINT_FORMAT_CHECKED(FF_VULKAN_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||
FF_FORMAT_ARG(vulkan->driver, "driver"),
|
||||
FF_FORMAT_ARG(vulkan->apiVersion, "api-version"),
|
||||
FF_FORMAT_ARG(vulkan->conformanceVersion, "conformance-version"),
|
||||
@@ -144,29 +142,25 @@ void ffGenerateVulkanJsonResult(FF_MAYBE_UNUSED FFVulkanOptions* options, yyjson
|
||||
}
|
||||
}
|
||||
|
||||
void ffPrintVulkanHelpFormat(void)
|
||||
{
|
||||
FF_PRINT_MODULE_FORMAT_HELP_CHECKED(FF_VULKAN_MODULE_NAME, "{2} - {1}", FF_VULKAN_NUM_FORMAT_ARGS, ((const char* []) {
|
||||
"Driver name - driver",
|
||||
"API version - api-version",
|
||||
"Conformance version - conformance-version",
|
||||
"Instance version - instance-version",
|
||||
}));
|
||||
}
|
||||
static FFModuleBaseInfo ffModuleInfo = {
|
||||
.name = FF_VULKAN_MODULE_NAME,
|
||||
.description = "Print highest Vulkan version supported by the GPU",
|
||||
.parseCommandOptions = (void*) ffParseVulkanCommandOptions,
|
||||
.parseJsonObject = (void*) ffParseVulkanJsonObject,
|
||||
.printModule = (void*) ffPrintVulkan,
|
||||
.generateJsonResult = (void*) ffGenerateVulkanJsonResult,
|
||||
.generateJsonConfig = (void*) ffGenerateVulkanJsonConfig,
|
||||
.formatArgs = FF_FORMAT_ARG_LIST(((FFModuleFormatArg[]) {
|
||||
{"Driver name", "driver"},
|
||||
{"API version", "api-version"},
|
||||
{"Conformance version", "conformance-version"},
|
||||
{"Instance version", "instance-version"},
|
||||
}))
|
||||
};
|
||||
|
||||
void ffInitVulkanOptions(FFVulkanOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(
|
||||
&options->moduleInfo,
|
||||
FF_VULKAN_MODULE_NAME,
|
||||
"Print highest Vulkan version supported by the GPU",
|
||||
ffParseVulkanCommandOptions,
|
||||
ffParseVulkanJsonObject,
|
||||
ffPrintVulkan,
|
||||
ffGenerateVulkanJsonResult,
|
||||
ffPrintVulkanHelpFormat,
|
||||
ffGenerateVulkanJsonConfig
|
||||
);
|
||||
options->moduleInfo = ffModuleInfo;
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user