From 4d86c53e81293f27d24790ce64b3d159efded9a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 22 Sep 2023 13:39:40 +0800 Subject: [PATCH] Custom: code cleanup --- CHANGELOG.md | 2 +- src/modules/custom/custom.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3a0896e5..60e4a3a1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,7 +21,7 @@ Features: * Support winget package manager detection, guarded behind `--allow-slow-operations` (Packages, Windows) * Print monitor type (built-in or external) (Display) * Support full GPU detection in WSL (Linux, GPU) -* Add `--module-key " "` as a magic case for hiding keys +* Add `--module-key " "` as a special case for hiding keys Bugfixes: * Fix fastfetch hanging in specific environment (#561) diff --git a/src/modules/custom/custom.c b/src/modules/custom/custom.c index 38dd4189a..6576cd3c5 100644 --- a/src/modules/custom/custom.c +++ b/src/modules/custom/custom.c @@ -12,7 +12,7 @@ void ffPrintCustom(FFCustomOptions* options) return; } - ffPrintLogoAndKey(options->moduleArgs.key.length == 0 ? NULL : FF_CUSTOM_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT); + ffPrintLogoAndKey(FF_CUSTOM_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT); ffStrbufWriteTo(&options->moduleArgs.outputFormat, stdout); puts(FASTFETCH_TEXT_MODIFIER_RESET); } @@ -21,6 +21,7 @@ void ffInitCustomOptions(FFCustomOptions* options) { ffOptionInitModuleBaseInfo(&options->moduleInfo, FF_CUSTOM_MODULE_NAME, ffParseCustomCommandOptions, ffParseCustomJsonObject, ffPrintCustom, NULL); ffOptionInitModuleArg(&options->moduleArgs); + ffStrbufSetStatic(&options->moduleArgs.key, " "); } bool ffParseCustomCommandOptions(FFCustomOptions* options, const char* key, const char* value)