mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-03 11:44:18 +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:
+23
-36
@@ -4,8 +4,7 @@
|
||||
#include "detection/board/board.h"
|
||||
#include "modules/board/board.h"
|
||||
|
||||
bool ffPrintBoard(FFBoardOptions* options)
|
||||
{
|
||||
bool ffPrintBoard(FFBoardOptions* options) {
|
||||
bool success = false;
|
||||
FFBoardResult result;
|
||||
ffStrbufInit(&result.name);
|
||||
@@ -14,34 +13,30 @@ bool ffPrintBoard(FFBoardOptions* options)
|
||||
ffStrbufInit(&result.serial);
|
||||
|
||||
const char* error = ffDetectBoard(&result);
|
||||
if(error)
|
||||
{
|
||||
if (error) {
|
||||
ffPrintError(FF_BOARD_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "%s", error);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if(result.name.length == 0)
|
||||
{
|
||||
if (result.name.length == 0) {
|
||||
ffPrintError(FF_BOARD_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "board_name is not set.");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if(options->moduleArgs.outputFormat.length == 0)
|
||||
{
|
||||
if (options->moduleArgs.outputFormat.length == 0) {
|
||||
ffPrintLogoAndKey(FF_BOARD_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
||||
ffStrbufWriteTo(&result.name, stdout);
|
||||
if (result.version.length)
|
||||
if (result.version.length) {
|
||||
printf(" (%s)", result.version.chars);
|
||||
}
|
||||
putchar('\n');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
FF_PRINT_FORMAT_CHECKED(FF_BOARD_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||
FF_ARG(result.name, "name"),
|
||||
FF_ARG(result.vendor, "vendor"),
|
||||
FF_ARG(result.version, "version"),
|
||||
FF_ARG(result.serial, "serial"),
|
||||
}));
|
||||
FF_ARG(result.name, "name"),
|
||||
FF_ARG(result.vendor, "vendor"),
|
||||
FF_ARG(result.version, "version"),
|
||||
FF_ARG(result.serial, "serial"),
|
||||
}));
|
||||
}
|
||||
success = true;
|
||||
|
||||
@@ -53,26 +48,23 @@ exit:
|
||||
return success;
|
||||
}
|
||||
|
||||
void ffParseBoardJsonObject(FFBoardOptions* options, yyjson_val* module)
|
||||
{
|
||||
void ffParseBoardJsonObject(FFBoardOptions* 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_BOARD_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "Unknown JSON key %s", unsafe_yyjson_get_str(key));
|
||||
}
|
||||
}
|
||||
|
||||
void ffGenerateBoardJsonConfig(FFBoardOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
{
|
||||
void ffGenerateBoardJsonConfig(FFBoardOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
ffJsonConfigGenerateModuleArgsConfig(doc, module, &options->moduleArgs);
|
||||
}
|
||||
|
||||
bool ffGenerateBoardJsonResult(FF_MAYBE_UNUSED FFBoardOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
{
|
||||
bool ffGenerateBoardJsonResult(FF_MAYBE_UNUSED FFBoardOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
bool success = false;
|
||||
FFBoardResult board;
|
||||
ffStrbufInit(&board.name);
|
||||
@@ -82,14 +74,12 @@ bool ffGenerateBoardJsonResult(FF_MAYBE_UNUSED FFBoardOptions* options, yyjson_m
|
||||
|
||||
const char* error = ffDetectBoard(&board);
|
||||
|
||||
if (error)
|
||||
{
|
||||
if (error) {
|
||||
yyjson_mut_obj_add_str(doc, module, "error", error);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (board.name.length == 0)
|
||||
{
|
||||
if (board.name.length == 0) {
|
||||
yyjson_mut_obj_add_str(doc, module, "error", "board_name is not set.");
|
||||
goto exit;
|
||||
}
|
||||
@@ -109,13 +99,11 @@ exit:
|
||||
return success;
|
||||
}
|
||||
|
||||
void ffInitBoardOptions(FFBoardOptions* options)
|
||||
{
|
||||
void ffInitBoardOptions(FFBoardOptions* options) {
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyBoardOptions(FFBoardOptions* options)
|
||||
{
|
||||
void ffDestroyBoardOptions(FFBoardOptions* options) {
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -133,5 +121,4 @@ FFModuleBaseInfo ffBoardModuleInfo = {
|
||||
{"Board vendor", "vendor"},
|
||||
{"Board version", "version"},
|
||||
{"Board serial number", "serial"},
|
||||
}))
|
||||
};
|
||||
}))};
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFBoardOptions
|
||||
{
|
||||
typedef struct FFBoardOptions {
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFBoardOptions;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user