mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-06 13:14:21 +01:00
Modules: return bool to indicate whether the detection is succeeded
This commit is contained in:
+10
-2
@@ -4,8 +4,9 @@
|
||||
#include "modules/host/host.h"
|
||||
#include "util/stringUtils.h"
|
||||
|
||||
void ffPrintHost(FFHostOptions* options)
|
||||
bool ffPrintHost(FFHostOptions* options)
|
||||
{
|
||||
bool success = false;
|
||||
FFHostResult host;
|
||||
ffStrbufInit(&host.family);
|
||||
ffStrbufInit(&host.name);
|
||||
@@ -56,6 +57,7 @@ void ffPrintHost(FFHostOptions* options)
|
||||
FF_FORMAT_ARG(host.uuid, "uuid"),
|
||||
}));
|
||||
}
|
||||
success = true;
|
||||
|
||||
exit:
|
||||
ffStrbufDestroy(&host.family);
|
||||
@@ -65,6 +67,8 @@ exit:
|
||||
ffStrbufDestroy(&host.serial);
|
||||
ffStrbufDestroy(&host.uuid);
|
||||
ffStrbufDestroy(&host.vendor);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void ffParseHostJsonObject(FFHostOptions* options, yyjson_val* module)
|
||||
@@ -85,8 +89,9 @@ void ffGenerateHostJsonConfig(FFHostOptions* options, yyjson_mut_doc* doc, yyjso
|
||||
ffJsonConfigGenerateModuleArgsConfig(doc, module, &options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffGenerateHostJsonResult(FF_MAYBE_UNUSED FFHostOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
bool ffGenerateHostJsonResult(FF_MAYBE_UNUSED FFHostOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
{
|
||||
bool success = false;
|
||||
FFHostResult host;
|
||||
ffStrbufInit(&host.family);
|
||||
ffStrbufInit(&host.name);
|
||||
@@ -117,6 +122,7 @@ void ffGenerateHostJsonResult(FF_MAYBE_UNUSED FFHostOptions* options, yyjson_mut
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "vendor", &host.vendor);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "serial", &host.serial);
|
||||
yyjson_mut_obj_add_strbuf(doc, obj, "uuid", &host.uuid);
|
||||
success = true;
|
||||
|
||||
exit:
|
||||
ffStrbufDestroy(&host.family);
|
||||
@@ -126,6 +132,8 @@ exit:
|
||||
ffStrbufDestroy(&host.serial);
|
||||
ffStrbufDestroy(&host.uuid);
|
||||
ffStrbufDestroy(&host.vendor);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void ffInitHostOptions(FFHostOptions* options)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#define FF_HOST_MODULE_NAME "Host"
|
||||
|
||||
void ffPrintHost(FFHostOptions* options);
|
||||
bool ffPrintHost(FFHostOptions* options);
|
||||
void ffInitHostOptions(FFHostOptions* options);
|
||||
void ffDestroyHostOptions(FFHostOptions* options);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user