From 303edb97ce098dfb5e2e57588bd56190a603cf8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Wed, 3 Sep 2025 14:20:23 +0800 Subject: [PATCH] Fastfetch: add option `--faction-trailing-zeros` --- src/data/help.json | 12 ++++++++++++ src/options/display.c | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/src/data/help.json b/src/data/help.json index e99c6867f..40382f2d8 100644 --- a/src/data/help.json +++ b/src/data/help.json @@ -846,6 +846,18 @@ "default": -1 } }, + { + "long": "fraction-trailing-zeros", + "desc": "Set when to keep trailing zeros", + "arg": { + "type": "enum", + "enum": { + "default": "Use the behavior defined internally", + "always": "Always keep trailing zeros", + "never": "Never keep trailing zeros" + } + } + }, { "long": "temp-unit", "desc": "Set the temperature unit", diff --git a/src/options/display.c b/src/options/display.c index 2d685dd88..00bc0898c 100644 --- a/src/options/display.c +++ b/src/options/display.c @@ -711,6 +711,15 @@ bool ffOptionsParseDisplayCommandLine(FFOptionsDisplay* options, const char* key } else if(ffStrEqualsIgnCase(key, "--fraction-ndigits")) options->fractionNdigits = (int8_t) ffOptionParseInt32(key, value); + else if(ffStrEqualsIgnCase(key, "--fraction-trailing-zeros")) + { + options->fractionTrailingZeros = (FFFractionTrailingZerosType) ffOptionParseEnum(key, value, (FFKeyValuePair[]) { + { "default", FF_FRACTION_TRAILING_ZEROS_TYPE_DEFAULT }, + { "show", FF_FRACTION_TRAILING_ZEROS_TYPE_SHOW }, + { "hide", FF_FRACTION_TRAILING_ZEROS_TYPE_HIDE }, + {}, + }); + } else if(ffStrEqualsIgnCase(key, "--no-buffer")) options->noBuffer = ffOptionParseBoolean(value); else if(ffStrStartsWithIgnCase(key, "--bar-"))