Global: puts more fastfetch-only properties into FFdata

This commit is contained in:
李通洲
2026-01-15 15:03:38 +08:00
parent 79a11c4728
commit d3453de73c
17 changed files with 168 additions and 156 deletions
+2 -1
View File
@@ -909,8 +909,9 @@ void ffOptionsDestroyDisplay(FFOptionsDisplay* options)
ffListDestroy(&options->constants);
}
void ffOptionsGenerateDisplayJsonConfig(FFOptionsDisplay* options, yyjson_mut_doc* doc)
void ffOptionsGenerateDisplayJsonConfig(FFdata* data, FFOptionsDisplay* options)
{
yyjson_mut_doc* doc = data->resultDoc;
yyjson_mut_val* obj = yyjson_mut_obj_add_obj(doc, doc->root, "display");
if (options->stat <= 0)
+2 -1
View File
@@ -1,5 +1,6 @@
#pragma once
#include "common/ffdata.h"
#include "common/percent.h"
#include "common/FFstrbuf.h"
#include "common/FFlist.h"
@@ -98,4 +99,4 @@ const char* ffOptionsParseDisplayJsonConfig(FFOptionsDisplay* options, yyjson_va
bool ffOptionsParseDisplayCommandLine(FFOptionsDisplay* options, const char* key, const char* value);
void ffOptionsInitDisplay(FFOptionsDisplay* options);
void ffOptionsDestroyDisplay(FFOptionsDisplay* options);
void ffOptionsGenerateDisplayJsonConfig(FFOptionsDisplay* options, yyjson_mut_doc* doc);
void ffOptionsGenerateDisplayJsonConfig(FFdata* data, FFOptionsDisplay* options);
+2 -1
View File
@@ -117,8 +117,9 @@ void ffOptionsDestroyGeneral(FF_MAYBE_UNUSED FFOptionsGeneral* options)
#endif
}
void ffOptionsGenerateGeneralJsonConfig(FFOptionsGeneral* options, yyjson_mut_doc* doc)
void ffOptionsGenerateGeneralJsonConfig(FFdata* data, FFOptionsGeneral* options)
{
yyjson_mut_doc* doc = data->resultDoc;
yyjson_mut_val* obj = yyjson_mut_obj_add_obj(doc, doc->root, "general");
yyjson_mut_obj_add_bool(doc, obj, "thread", options->multithreading);
+2 -2
View File
@@ -1,6 +1,6 @@
#pragma once
#include "common/FFstrbuf.h"
#include "common/ffdata.h"
typedef enum __attribute__((__packed__)) FFDsForceDrmType
{
@@ -28,4 +28,4 @@ const char* ffOptionsParseGeneralJsonConfig(FFOptionsGeneral* options, yyjson_va
bool ffOptionsParseGeneralCommandLine(FFOptionsGeneral* options, const char* key, const char* value);
void ffOptionsInitGeneral(FFOptionsGeneral* options);
void ffOptionsDestroyGeneral(FFOptionsGeneral* options);
void ffOptionsGenerateGeneralJsonConfig(FFOptionsGeneral* options, yyjson_mut_doc* doc);
void ffOptionsGenerateGeneralJsonConfig(FFdata* data, FFOptionsGeneral* options);
+2 -1
View File
@@ -466,8 +466,9 @@ const char* ffOptionsParseLogoJsonConfig(FFOptionsLogo* options, yyjson_val* roo
return NULL;
}
void ffOptionsGenerateLogoJsonConfig(FFOptionsLogo* options, yyjson_mut_doc* doc)
void ffOptionsGenerateLogoJsonConfig(FFdata* data, FFOptionsLogo* options)
{
yyjson_mut_doc* doc = data->resultDoc;
yyjson_mut_val* obj = yyjson_mut_obj(doc);
switch (options->type)
+19 -19
View File
@@ -1,28 +1,28 @@
#pragma once
#include "common/FFstrbuf.h"
#include "common/ffdata.h"
#define FASTFETCH_LOGO_MAX_NAMES 9
#define FASTFETCH_LOGO_MAX_COLORS 9 //two digits would make parsing much more complicated (index 1 - 9)
#define FASTFETCH_LOGO_MAX_COLORS 9 // two digits would make parsing much more complicated (index 1 - 9)
typedef enum __attribute__((__packed__)) FFLogoType
{
FF_LOGO_TYPE_AUTO, //if something is given, first try builtin, then file. Otherwise detect logo
FF_LOGO_TYPE_BUILTIN, //builtin ascii art
FF_LOGO_TYPE_SMALL, //builtin ascii art, small version
FF_LOGO_TYPE_FILE, //text file, printed with color code replacement
FF_LOGO_TYPE_FILE_RAW, //text file, printed as is
FF_LOGO_TYPE_DATA, //text data, printed with color code replacement
FF_LOGO_TYPE_DATA_RAW, //text data, printed as is
FF_LOGO_TYPE_COMMAND_RAW, //command to generate text data, printed as is
FF_LOGO_TYPE_IMAGE_SIXEL, //image file, printed as sixel codes
FF_LOGO_TYPE_IMAGE_KITTY, //image file, printed as kitty graphics protocol
FF_LOGO_TYPE_IMAGE_KITTY_DIRECT, //image file, tell the terminal emulator to read image data from the specified file (Supported by kitty and wezterm)
FF_LOGO_TYPE_IMAGE_KITTY_ICAT, //image file, use `kitten icat` to display the image. Requires binary `kitten` to be installed"
FF_LOGO_TYPE_IMAGE_ITERM, //image file, printed as iterm graphics protocol
FF_LOGO_TYPE_IMAGE_CHAFA, //image file, printed as ascii art using libchafa
FF_LOGO_TYPE_IMAGE_RAW, //image file, printed as raw binary string
FF_LOGO_TYPE_NONE, //--logo none
FF_LOGO_TYPE_AUTO, // if something is given, first try builtin, then file. Otherwise detect logo
FF_LOGO_TYPE_BUILTIN, // builtin ascii art
FF_LOGO_TYPE_SMALL, // builtin ascii art, small version
FF_LOGO_TYPE_FILE, // text file, printed with color code replacement
FF_LOGO_TYPE_FILE_RAW, // text file, printed as is
FF_LOGO_TYPE_DATA, // text data, printed with color code replacement
FF_LOGO_TYPE_DATA_RAW, // text data, printed as is
FF_LOGO_TYPE_COMMAND_RAW, // command to generate text data, printed as is
FF_LOGO_TYPE_IMAGE_SIXEL, // image file, printed as sixel codes
FF_LOGO_TYPE_IMAGE_KITTY, // image file, printed as kitty graphics protocol
FF_LOGO_TYPE_IMAGE_KITTY_DIRECT, // image file, tell the terminal emulator to read image data from the specified file (Supported by kitty and wezterm)
FF_LOGO_TYPE_IMAGE_KITTY_ICAT, // image file, use `kitten icat` to display the image. Requires binary `kitten` to be installed"
FF_LOGO_TYPE_IMAGE_ITERM, // image file, printed as iterm graphics protocol
FF_LOGO_TYPE_IMAGE_CHAFA, // image file, printed as ascii art using libchafa
FF_LOGO_TYPE_IMAGE_RAW, // image file, printed as raw binary string
FF_LOGO_TYPE_NONE, // `--logo none`, but still applies colors to the system information output (unless `--pipe` is set)
} FFLogoType;
typedef enum __attribute__((__packed__)) FFLogoPosition
@@ -58,4 +58,4 @@ void ffOptionsInitLogo(FFOptionsLogo* options);
bool ffOptionsParseLogoCommandLine(FFOptionsLogo* options, const char* key, const char* value);
void ffOptionsDestroyLogo(FFOptionsLogo* options);
const char* ffOptionsParseLogoJsonConfig(FFOptionsLogo* options, yyjson_val* root);
void ffOptionsGenerateLogoJsonConfig(FFOptionsLogo* options, yyjson_mut_doc* doc);
void ffOptionsGenerateLogoJsonConfig(FFdata* data, FFOptionsLogo* options);