mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-30 00:37:23 +01:00
Global: improve support of --help *-format
Also fix some bugs found when refactoring
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
#define FF_POWERADAPTER_DISPLAY_NAME "Power Adapter"
|
||||
#define FF_POWERADAPTER_MODULE_ARGS 5
|
||||
#define FF_POWERADAPTER_NUM_FORMAT_ARGS 5
|
||||
|
||||
void ffPrintPowerAdapter(FFPowerAdapterOptions* options)
|
||||
{
|
||||
@@ -42,7 +42,7 @@ void ffPrintPowerAdapter(FFPowerAdapterOptions* options)
|
||||
}
|
||||
else
|
||||
{
|
||||
ffPrintFormat(FF_POWERADAPTER_DISPLAY_NAME, i, &options->moduleArgs, FF_POWERADAPTER_MODULE_ARGS, (FFformatarg[]){
|
||||
ffPrintFormat(FF_POWERADAPTER_DISPLAY_NAME, i, &options->moduleArgs, FF_POWERADAPTER_NUM_FORMAT_ARGS, (FFformatarg[]){
|
||||
{FF_FORMAT_ARG_TYPE_INT, &result->watts},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &result->name},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &result->manufacturer},
|
||||
@@ -62,7 +62,7 @@ void ffPrintPowerAdapter(FFPowerAdapterOptions* options)
|
||||
|
||||
void ffInitPowerAdapterOptions(FFPowerAdapterOptions* options)
|
||||
{
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_POWERADAPTER_MODULE_NAME, ffParsePowerAdapterCommandOptions, ffParsePowerAdapterJsonObject, ffPrintPowerAdapter, ffGeneratePowerAdapterJson);
|
||||
ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_POWERADAPTER_MODULE_NAME, ffParsePowerAdapterCommandOptions, ffParsePowerAdapterJsonObject, ffPrintPowerAdapter, ffGeneratePowerAdapterJson, ffPrintPowerAdapterHelpFormat);
|
||||
ffOptionInitModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -126,3 +126,14 @@ void ffGeneratePowerAdapterJson(FF_MAYBE_UNUSED FFPowerAdapterOptions* options,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ffPrintPowerAdapterHelpFormat(void)
|
||||
{
|
||||
ffPrintModuleFormatHelp(FF_POWERADAPTER_MODULE_NAME, "{1}W", FF_POWERADAPTER_NUM_FORMAT_ARGS, (const char* []) {
|
||||
"PowerAdapter watts",
|
||||
"PowerAdapter name",
|
||||
"PowerAdapter manufacturer",
|
||||
"PowerAdapter model",
|
||||
"PowerAdapter description"
|
||||
});
|
||||
}
|
||||
|
||||
@@ -10,3 +10,4 @@ bool ffParsePowerAdapterCommandOptions(FFPowerAdapterOptions* options, const cha
|
||||
void ffDestroyPowerAdapterOptions(FFPowerAdapterOptions* options);
|
||||
void ffParsePowerAdapterJsonObject(FFPowerAdapterOptions* options, yyjson_val* module);
|
||||
void ffGeneratePowerAdapterJson(FFPowerAdapterOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module);
|
||||
void ffPrintPowerAdapterHelpFormat(void);
|
||||
|
||||
Reference in New Issue
Block a user