mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-06 13:14:21 +01:00
Global: make FFinstance instance a global variable
As discussed in https://github.com/fastfetch-cli/fastfetch/discussions/473
This commit is contained in:
@@ -7,26 +7,26 @@
|
||||
#define FF_TERMINALFONT_DISPLAY_NAME "Terminal Font"
|
||||
#define FF_TERMINALFONT_NUM_FORMAT_ARGS 4
|
||||
|
||||
void ffPrintTerminalFont(FFinstance* instance, FFTerminalFontOptions* options)
|
||||
void ffPrintTerminalFont(FFTerminalFontOptions* options)
|
||||
{
|
||||
FFTerminalFontResult terminalFont;
|
||||
ffFontInit(&terminalFont.font);
|
||||
ffStrbufInit(&terminalFont.error);
|
||||
|
||||
if(!ffDetectTerminalFont(instance, &terminalFont))
|
||||
if(!ffDetectTerminalFont(&terminalFont))
|
||||
{
|
||||
ffPrintError(instance, FF_TERMINALFONT_DISPLAY_NAME, 0, &options->moduleArgs, "%s", terminalFont.error.chars);
|
||||
ffPrintError(FF_TERMINALFONT_DISPLAY_NAME, 0, &options->moduleArgs, "%s", terminalFont.error.chars);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(options->moduleArgs.outputFormat.length == 0)
|
||||
{
|
||||
ffPrintLogoAndKey(instance, FF_TERMINALFONT_DISPLAY_NAME, 0, &options->moduleArgs.key, &options->moduleArgs.keyColor);
|
||||
ffPrintLogoAndKey(FF_TERMINALFONT_DISPLAY_NAME, 0, &options->moduleArgs.key, &options->moduleArgs.keyColor);
|
||||
ffStrbufPutTo(&terminalFont.font.pretty, stdout);
|
||||
}
|
||||
else
|
||||
{
|
||||
ffPrintFormat(instance, FF_TERMINALFONT_DISPLAY_NAME, 0, &options->moduleArgs, FF_TERMINALFONT_NUM_FORMAT_ARGS, (FFformatarg[]){
|
||||
ffPrintFormat(FF_TERMINALFONT_DISPLAY_NAME, 0, &options->moduleArgs, FF_TERMINALFONT_NUM_FORMAT_ARGS, (FFformatarg[]){
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &terminalFont.font.pretty},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &terminalFont.font.name},
|
||||
{FF_FORMAT_ARG_TYPE_STRBUF, &terminalFont.font.size},
|
||||
@@ -60,7 +60,7 @@ void ffDestroyTerminalFontOptions(FFTerminalFontOptions* options)
|
||||
ffOptionDestroyModuleArg(&options->moduleArgs);
|
||||
}
|
||||
|
||||
void ffParseTerminalFontJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
void ffParseTerminalFontJsonObject(yyjson_val* module)
|
||||
{
|
||||
FFTerminalFontOptions __attribute__((__cleanup__(ffDestroyTerminalFontOptions))) options;
|
||||
ffInitTerminalFontOptions(&options);
|
||||
@@ -78,9 +78,9 @@ void ffParseTerminalFontJsonObject(FFinstance* instance, yyjson_val* module)
|
||||
if (ffJsonConfigParseModuleArgs(key, val, &options.moduleArgs))
|
||||
continue;
|
||||
|
||||
ffPrintError(instance, FF_TERMINALFONT_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
ffPrintError(FF_TERMINALFONT_MODULE_NAME, 0, &options.moduleArgs, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
|
||||
ffPrintTerminalFont(instance, &options);
|
||||
ffPrintTerminalFont(&options);
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
|
||||
#define FF_TERMINALFONT_MODULE_NAME "TerminalFont"
|
||||
|
||||
void ffPrintTerminalFont(FFinstance* instance, FFTerminalFontOptions* options);
|
||||
void ffPrintTerminalFont(FFTerminalFontOptions* options);
|
||||
void ffInitTerminalFontOptions(FFTerminalFontOptions* options);
|
||||
bool ffParseTerminalFontCommandOptions(FFTerminalFontOptions* options, const char* key, const char* value);
|
||||
void ffDestroyTerminalFontOptions(FFTerminalFontOptions* options);
|
||||
void ffParseTerminalFontJsonObject(FFinstance* instance, yyjson_val* module);
|
||||
void ffParseTerminalFontJsonObject(yyjson_val* module);
|
||||
|
||||
Reference in New Issue
Block a user