mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-04 20:24:19 +01:00
Chore: run clang-format
```bash find . -type f \( -name "*.c" -o -name "*.h" -o -name "*.cpp" -o -name "*.hpp" \) ! -path "src/3rdparty/*" -print0 | xargs -0 clang-format -i ```
This commit is contained in:
+25
-37
@@ -4,8 +4,7 @@
|
||||
#include "detection/lm/lm.h"
|
||||
#include "modules/lm/lm.h"
|
||||
|
||||
bool ffPrintLM(FFLMOptions* options)
|
||||
{
|
||||
bool ffPrintLM(FFLMOptions* options) {
|
||||
bool success = false;
|
||||
FFLMResult result;
|
||||
ffStrbufInit(&result.service);
|
||||
@@ -13,35 +12,32 @@ bool ffPrintLM(FFLMOptions* options)
|
||||
ffStrbufInit(&result.version);
|
||||
const char* error = ffDetectLM(&result);
|
||||
|
||||
if(error)
|
||||
{
|
||||
if (error) {
|
||||
ffPrintError(FF_LM_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "%s", error);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if(result.service.length == 0)
|
||||
{
|
||||
if (result.service.length == 0) {
|
||||
ffPrintError(FF_LM_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "No LM service found");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if(options->moduleArgs.outputFormat.length == 0)
|
||||
{
|
||||
if (options->moduleArgs.outputFormat.length == 0) {
|
||||
ffPrintLogoAndKey(FF_LM_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
||||
ffStrbufWriteTo(&result.service, stdout);
|
||||
if(result.version.length)
|
||||
if (result.version.length) {
|
||||
printf(" %s", result.version.chars);
|
||||
if(result.type.length)
|
||||
}
|
||||
if (result.type.length) {
|
||||
printf(" (%s)", result.type.chars);
|
||||
}
|
||||
putchar('\n');
|
||||
}
|
||||
else
|
||||
{
|
||||
FF_PRINT_FORMAT_CHECKED(FF_LM_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||
FF_ARG(result.service, "service"),
|
||||
FF_ARG(result.type, "type"),
|
||||
FF_ARG(result.version, "version"),
|
||||
}));
|
||||
} else {
|
||||
FF_PRINT_FORMAT_CHECKED(FF_LM_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||
FF_ARG(result.service, "service"),
|
||||
FF_ARG(result.type, "type"),
|
||||
FF_ARG(result.version, "version"),
|
||||
}));
|
||||
}
|
||||
success = true;
|
||||
|
||||
@@ -53,26 +49,23 @@ exit:
|
||||
return success;
|
||||
}
|
||||
|
||||
void ffParseLMJsonObject(FFLMOptions* options, yyjson_val* module)
|
||||
{
|
||||
void ffParseLMJsonObject(FFLMOptions* options, yyjson_val* module) {
|
||||
yyjson_val *key, *val;
|
||||
size_t idx, max;
|
||||
yyjson_obj_foreach(module, idx, max, key, val)
|
||||
{
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs))
|
||||
yyjson_obj_foreach (module, idx, max, key, val) {
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options->moduleArgs)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ffPrintError(FF_LM_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "Unknown JSON key %s", unsafe_yyjson_get_str(key));
|
||||
}
|
||||
}
|
||||
|
||||
void ffGenerateLMJsonConfig(FFLMOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
{
|
||||
void ffGenerateLMJsonConfig(FFLMOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
ffJsonConfigGenerateModuleArgsConfig(doc, module, &options->moduleArgs);
|
||||
}
|
||||
|
||||
bool ffGenerateLMJsonResult(FF_MAYBE_UNUSED FFLMOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
{
|
||||
bool ffGenerateLMJsonResult(FF_MAYBE_UNUSED FFLMOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
bool success = false;
|
||||
FFLMResult result;
|
||||
ffStrbufInit(&result.service);
|
||||
@@ -80,14 +73,12 @@ bool ffGenerateLMJsonResult(FF_MAYBE_UNUSED FFLMOptions* options, yyjson_mut_doc
|
||||
ffStrbufInit(&result.version);
|
||||
const char* error = ffDetectLM(&result);
|
||||
|
||||
if(error)
|
||||
{
|
||||
if (error) {
|
||||
yyjson_mut_obj_add_str(doc, module, "error", error);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if(result.service.length == 0)
|
||||
{
|
||||
if (result.service.length == 0) {
|
||||
yyjson_mut_obj_add_str(doc, module, "error", "No LM service found");
|
||||
goto exit;
|
||||
}
|
||||
@@ -106,13 +97,11 @@ exit:
|
||||
return success;
|
||||
}
|
||||
|
||||
void ffInitLMOptions(FFLMOptions* options)
|
||||
{
|
||||
void ffInitLMOptions(FFLMOptions* options) {
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyLMOptions(FFLMOptions* options)
|
||||
{
|
||||
void ffDestroyLMOptions(FFLMOptions* options) {
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -129,5 +118,4 @@ FFModuleBaseInfo ffLMModuleInfo = {
|
||||
{"LM service", "service"},
|
||||
{"LM type", "type"},
|
||||
{"LM version", "version"},
|
||||
}))
|
||||
};
|
||||
}))};
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFLMOptions
|
||||
{
|
||||
typedef struct FFLMOptions {
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFLMOptions;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user