mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-05 20:54:21 +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:
+21
-23
@@ -3,33 +3,29 @@
|
||||
#include "modules/logo/logo.h"
|
||||
#include "options/logo.h"
|
||||
|
||||
bool ffPrintLogo(FF_MAYBE_UNUSED FFLogoOptions* options)
|
||||
{
|
||||
bool ffPrintLogo(FF_MAYBE_UNUSED FFLogoOptions* options) {
|
||||
ffPrintError(FF_LOGO_MODULE_NAME, 0, NULL, FF_PRINT_TYPE_DEFAULT, "Supported in JSON format only");
|
||||
return false;
|
||||
}
|
||||
|
||||
void ffParseLogoJsonObject(FF_MAYBE_UNUSED FFLogoOptions* options, FF_MAYBE_UNUSED yyjson_val* module)
|
||||
{
|
||||
void ffParseLogoJsonObject(FF_MAYBE_UNUSED FFLogoOptions* options, FF_MAYBE_UNUSED yyjson_val* module) {
|
||||
yyjson_val *key, *val;
|
||||
size_t idx, max;
|
||||
yyjson_obj_foreach(module, idx, max, key, val)
|
||||
{
|
||||
if (unsafe_yyjson_equals_str(key, "type") || unsafe_yyjson_equals_str(key, "condition"))
|
||||
yyjson_obj_foreach (module, idx, max, key, val) {
|
||||
if (unsafe_yyjson_equals_str(key, "type") || unsafe_yyjson_equals_str(key, "condition")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ffPrintError(FF_LOGO_MODULE_NAME, 0, NULL, FF_PRINT_TYPE_NO_CUSTOM_KEY, "Unknown JSON key %s", unsafe_yyjson_get_str(key));
|
||||
}
|
||||
}
|
||||
|
||||
bool ffGenerateLogoJsonResult(FF_MAYBE_UNUSED FFLogoOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
{
|
||||
bool ffGenerateLogoJsonResult(FF_MAYBE_UNUSED FFLogoOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
FFLogoSize size = FF_LOGO_SIZE_UNKNOWN;
|
||||
FFOptionsLogo* logoOptions = &instance.config.logo;
|
||||
if (logoOptions->type == FF_LOGO_TYPE_SMALL)
|
||||
if (logoOptions->type == FF_LOGO_TYPE_SMALL) {
|
||||
size = FF_LOGO_SIZE_SMALL;
|
||||
else if (logoOptions->type != FF_LOGO_TYPE_BUILTIN && logoOptions->type != FF_LOGO_TYPE_AUTO)
|
||||
{
|
||||
} else if (logoOptions->type != FF_LOGO_TYPE_BUILTIN && logoOptions->type != FF_LOGO_TYPE_AUTO) {
|
||||
yyjson_mut_obj_add_str(doc, module, "error", "Only 'builtin' and 'small' logo types are supported");
|
||||
return false;
|
||||
}
|
||||
@@ -38,8 +34,7 @@ bool ffGenerateLogoJsonResult(FF_MAYBE_UNUSED FFLogoOptions* options, yyjson_mut
|
||||
? ffLogoGetBuiltinForName(&logoOptions->source, size)
|
||||
: ffLogoGetBuiltinDetected(size);
|
||||
|
||||
if (!logo)
|
||||
{
|
||||
if (!logo) {
|
||||
yyjson_mut_obj_add_str(doc, module, "error", "No built-in logo found for the specified name/size");
|
||||
return false;
|
||||
}
|
||||
@@ -49,33 +44,36 @@ bool ffGenerateLogoJsonResult(FF_MAYBE_UNUSED FFLogoOptions* options, yyjson_mut
|
||||
yyjson_mut_obj_add_str(doc, obj, "lines", logo->lines);
|
||||
|
||||
yyjson_mut_val* namesArr = yyjson_mut_obj_add_arr(doc, obj, "names");
|
||||
for (size_t i = 0; i < FASTFETCH_LOGO_MAX_NAMES && logo->names[i]; i++)
|
||||
for (size_t i = 0; i < FASTFETCH_LOGO_MAX_NAMES && logo->names[i]; i++) {
|
||||
yyjson_mut_arr_add_str(doc, namesArr, logo->names[i]);
|
||||
}
|
||||
|
||||
yyjson_mut_val* colorsArr = yyjson_mut_obj_add_arr(doc, obj, "colors");
|
||||
for (size_t i = 0; i < FASTFETCH_LOGO_MAX_COLORS && logo->colors[i]; i++)
|
||||
for (size_t i = 0; i < FASTFETCH_LOGO_MAX_COLORS && logo->colors[i]; i++) {
|
||||
yyjson_mut_arr_add_str(doc, colorsArr, logo->colors[i]);
|
||||
}
|
||||
|
||||
yyjson_mut_obj_add_str(doc, obj, "colorKeys", logo->colorKeys);
|
||||
yyjson_mut_obj_add_str(doc, obj, "colorTitle", logo->colorTitle);
|
||||
|
||||
yyjson_mut_val* typeArr = yyjson_mut_obj_add_arr(doc, obj, "type");
|
||||
if (logo->type & FF_LOGO_LINE_TYPE_NORMAL)
|
||||
if (logo->type & FF_LOGO_LINE_TYPE_NORMAL) {
|
||||
yyjson_mut_arr_add_str(doc, typeArr, "normal");
|
||||
if (logo->type & FF_LOGO_LINE_TYPE_SMALL_BIT)
|
||||
}
|
||||
if (logo->type & FF_LOGO_LINE_TYPE_SMALL_BIT) {
|
||||
yyjson_mut_arr_add_str(doc, typeArr, "small");
|
||||
if (logo->type & FF_LOGO_LINE_TYPE_ALTER_BIT)
|
||||
}
|
||||
if (logo->type & FF_LOGO_LINE_TYPE_ALTER_BIT) {
|
||||
yyjson_mut_arr_add_str(doc, typeArr, "alter");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ffInitLogoOptions(FF_MAYBE_UNUSED FFLogoOptions* options)
|
||||
{
|
||||
void ffInitLogoOptions(FF_MAYBE_UNUSED FFLogoOptions* options) {
|
||||
}
|
||||
|
||||
void ffDestroyLogoOptions(FF_MAYBE_UNUSED FFLogoOptions* options)
|
||||
{
|
||||
void ffDestroyLogoOptions(FF_MAYBE_UNUSED FFLogoOptions* options) {
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffLogoModuleInfo = {
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFLogoOptions
|
||||
{
|
||||
typedef struct FFLogoOptions {
|
||||
} FFLogoOptions;
|
||||
|
||||
static_assert(sizeof(FFLogoOptions) <= FF_OPTION_MAX_SIZE, "FFLogoOptions size exceeds maximum allowed size");
|
||||
|
||||
Reference in New Issue
Block a user