From 14cd933969d121bdcd13e7f6325f417c8150de4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BD=D0=B8=D0=BB=20=D0=93=D0=BE=D0=BB=D0=B4?= =?UTF-8?q?=D1=8B=D1=88=D0=B5=D0=B2?= Date: Sun, 5 Apr 2026 01:46:25 +0300 Subject: [PATCH] fix(help): align format placeholders dynamically --- src/fastfetch.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/fastfetch.c b/src/fastfetch.c index f78a19a13..52af0db15 100644 --- a/src/fastfetch.c +++ b/src/fastfetch.c @@ -62,10 +62,18 @@ static void printCommandFormatHelp(const char* command) { puts("To see how a format string is constructed, take a look at https://github.com/fastfetch-cli/fastfetch/wiki/Format-String-Guide."); puts("The following variables are passed:"); + uint32_t maxWidth = 20; + for (unsigned i = 0; i < baseInfo->formatArgs.count; i++) { + uint32_t len = (uint32_t) strlen(baseInfo->formatArgs.args[i].name) + 2; + if (len > maxWidth) { + maxWidth = len; + } + } + for (unsigned i = 0; i < baseInfo->formatArgs.count; i++) { const FFModuleFormatArg* arg = &baseInfo->formatArgs.args[i]; ffStrbufSetF(&variable, "{%s}", arg->name); - printf("%20s: %s\n", variable.chars, arg->desc); + printf("%*s: %s\n", (int) maxWidth, variable.chars, arg->desc); } } else { fprintf(stderr, "Error: Module '%s' doesn't support output formatting\n", baseInfo->name);