mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-07 21:50:08 +01:00
@@ -4,8 +4,6 @@
|
||||
#include "detection/terminalfont/terminalfont.h"
|
||||
#include "modules/terminalfont/terminalfont.h"
|
||||
|
||||
#define FF_TERMINALFONT_DISPLAY_NAME "Terminal Font"
|
||||
|
||||
bool ffPrintTerminalFont(FFTerminalFontOptions* options) {
|
||||
bool success = false;
|
||||
FFTerminalFontResult terminalFont;
|
||||
@@ -14,10 +12,10 @@ bool ffPrintTerminalFont(FFTerminalFontOptions* options) {
|
||||
ffStrbufInit(&terminalFont.error);
|
||||
|
||||
if (!ffDetectTerminalFont(&terminalFont)) {
|
||||
ffPrintError(FF_TERMINALFONT_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "%s", terminalFont.error.chars);
|
||||
ffPrintError(FF_MODULE_GET_DISPLAY_NAME(TerminalFont), 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "%s", terminalFont.error.chars);
|
||||
} else {
|
||||
if (options->moduleArgs.outputFormat.length == 0) {
|
||||
ffPrintLogoAndKey(FF_TERMINALFONT_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
||||
ffPrintLogoAndKey(FF_MODULE_GET_DISPLAY_NAME(TerminalFont), 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
||||
ffStrbufWriteTo(&terminalFont.font.pretty, stdout);
|
||||
if (terminalFont.fallback.pretty.length) {
|
||||
fputs(" / ", stdout);
|
||||
@@ -25,7 +23,7 @@ bool ffPrintTerminalFont(FFTerminalFontOptions* options) {
|
||||
}
|
||||
putchar('\n');
|
||||
} else {
|
||||
FF_PRINT_FORMAT_CHECKED(FF_TERMINALFONT_DISPLAY_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||
FF_PRINT_FORMAT_CHECKED(FF_MODULE_GET_DISPLAY_NAME(TerminalFont), 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, ((FFformatarg[]) {
|
||||
FF_ARG(terminalFont.font.pretty, "combined"),
|
||||
FF_ARG(terminalFont.font.name, "name"),
|
||||
FF_ARG(terminalFont.font.size, "size"),
|
||||
@@ -50,7 +48,7 @@ void ffParseTerminalFontJsonObject(FFTerminalFontOptions* options, yyjson_val* m
|
||||
continue;
|
||||
}
|
||||
|
||||
ffPrintError(FF_TERMINALFONT_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "Unknown JSON key %s", unsafe_yyjson_get_str(key));
|
||||
ffPrintError(FF_MODULE_GET_DISPLAY_NAME(TerminalFont), 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "Unknown JSON key %s", unsafe_yyjson_get_str(key));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +103,7 @@ void ffDestroyTerminalFontOptions(FFTerminalFontOptions* options) {
|
||||
}
|
||||
|
||||
FFModuleBaseInfo ffTerminalFontModuleInfo = {
|
||||
.name = FF_TERMINALFONT_MODULE_NAME,
|
||||
.name = "TerminalFont",
|
||||
.description = "Print the font name and size used by the current terminal",
|
||||
.displayName = {
|
||||
.en = "Terminal Font",
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
#include "option.h"
|
||||
|
||||
#define FF_TERMINALFONT_MODULE_NAME "TerminalFont"
|
||||
|
||||
bool ffPrintTerminalFont(FFTerminalFontOptions* options);
|
||||
void ffInitTerminalFontOptions(FFTerminalFontOptions* options);
|
||||
void ffDestroyTerminalFontOptions(FFTerminalFontOptions* options);
|
||||
|
||||
Reference in New Issue
Block a user