mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-30 00:37:23 +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:
+17
-35
@@ -5,12 +5,10 @@
|
||||
#include "detection/de/de.h"
|
||||
#include "modules/de/de.h"
|
||||
|
||||
bool ffPrintDE(FFDEOptions* options)
|
||||
{
|
||||
bool ffPrintDE(FFDEOptions* options) {
|
||||
const FFDisplayServerResult* result = ffConnectDisplayServer();
|
||||
|
||||
if(result->dePrettyName.length == 0)
|
||||
{
|
||||
if (result->dePrettyName.length == 0) {
|
||||
ffPrintError(FF_DE_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "No DE found");
|
||||
return false;
|
||||
}
|
||||
@@ -18,43 +16,33 @@ bool ffPrintDE(FFDEOptions* options)
|
||||
FF_STRBUF_AUTO_DESTROY version = ffStrbufCreate();
|
||||
ffDetectDEVersion(&result->dePrettyName, &version, options);
|
||||
|
||||
if(options->moduleArgs.outputFormat.length == 0)
|
||||
{
|
||||
if (options->moduleArgs.outputFormat.length == 0) {
|
||||
ffPrintLogoAndKey(FF_DE_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
||||
|
||||
ffStrbufWriteTo(&result->dePrettyName, stdout);
|
||||
|
||||
if(version.length > 0)
|
||||
{
|
||||
if (version.length > 0) {
|
||||
putchar(' ');
|
||||
ffStrbufWriteTo(&version, stdout);
|
||||
}
|
||||
|
||||
putchar('\n');
|
||||
}
|
||||
else
|
||||
{
|
||||
FF_PRINT_FORMAT_CHECKED(FF_DE_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]){
|
||||
FF_ARG(result->deProcessName, "process-name"),
|
||||
FF_ARG(result->dePrettyName, "pretty-name"),
|
||||
FF_ARG(version, "version")
|
||||
}));
|
||||
} else {
|
||||
FF_PRINT_FORMAT_CHECKED(FF_DE_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {FF_ARG(result->deProcessName, "process-name"), FF_ARG(result->dePrettyName, "pretty-name"), FF_ARG(version, "version")}));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ffParseDEJsonObject(FFDEOptions* options, yyjson_val* module)
|
||||
{
|
||||
void ffParseDEJsonObject(FFDEOptions* 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;
|
||||
}
|
||||
|
||||
if (unsafe_yyjson_equals_str(key, "slowVersionDetection"))
|
||||
{
|
||||
if (unsafe_yyjson_equals_str(key, "slowVersionDetection")) {
|
||||
ffPrintError(FF_DE_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "Key `slowVersionDetection` is deprecated, it's always true");
|
||||
continue;
|
||||
}
|
||||
@@ -63,17 +51,14 @@ void ffParseDEJsonObject(FFDEOptions* options, yyjson_val* module)
|
||||
}
|
||||
}
|
||||
|
||||
void ffGenerateDEJsonConfig(FFDEOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
{
|
||||
void ffGenerateDEJsonConfig(FFDEOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
ffJsonConfigGenerateModuleArgsConfig(doc, module, &options->moduleArgs);
|
||||
}
|
||||
|
||||
bool ffGenerateDEJsonResult(FF_MAYBE_UNUSED FFDEOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
{
|
||||
bool ffGenerateDEJsonResult(FF_MAYBE_UNUSED FFDEOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module) {
|
||||
const FFDisplayServerResult* result = ffConnectDisplayServer();
|
||||
|
||||
if(result->dePrettyName.length == 0)
|
||||
{
|
||||
if (result->dePrettyName.length == 0) {
|
||||
yyjson_mut_obj_add_str(doc, module, "error", "No DE found");
|
||||
return false;
|
||||
}
|
||||
@@ -88,13 +73,11 @@ bool ffGenerateDEJsonResult(FF_MAYBE_UNUSED FFDEOptions* options, yyjson_mut_doc
|
||||
return true;
|
||||
}
|
||||
|
||||
void ffInitDEOptions(FFDEOptions* options)
|
||||
{
|
||||
void ffInitDEOptions(FFDEOptions* options) {
|
||||
ffOptionInitModuleArg(&options->moduleArgs, "");
|
||||
}
|
||||
|
||||
void ffDestroyDEOptions(FFDEOptions* options)
|
||||
{
|
||||
void ffDestroyDEOptions(FFDEOptions* options) {
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
@@ -111,5 +94,4 @@ FFModuleBaseInfo ffDEModuleInfo = {
|
||||
{"DE process name", "process-name"},
|
||||
{"DE pretty name", "pretty-name"},
|
||||
{"DE version", "version"},
|
||||
}))
|
||||
};
|
||||
}))};
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
|
||||
#include "common/option.h"
|
||||
|
||||
typedef struct FFDEOptions
|
||||
{
|
||||
typedef struct FFDEOptions {
|
||||
FFModuleArgs moduleArgs;
|
||||
} FFDEOptions;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user