From c988777c79152bd760a2a703f83ebe3aab2538df Mon Sep 17 00:00:00 2001 From: Linus Dierheimer Date: Thu, 11 Mar 2021 19:54:34 +0100 Subject: [PATCH] small changes to package options --- src/fastfetch.c | 8 +++++--- src/modules/packages.c | 21 +++++++-------------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/src/fastfetch.c b/src/fastfetch.c index 25d893921..4f0ce9401 100644 --- a/src/fastfetch.c +++ b/src/fastfetch.c @@ -161,10 +161,9 @@ static inline void printCommandHelpPackagesFormat() "\n" " is a string of maximum length 32, which is passed to printf as the format string.\n" "if --packages-combined is set to false, the numbers of packages are passed to printf in following order as uint32_t:\n" - "pacman, flatpak\n" - "else, the total number of packages is passed as uint32_t\n" + "all, pacman, flatpak, all\n" "if an value is disabled via a packages-* argument, or could not be determined, zero is passed\n" - "The default value is something like \"%u (pacman), %u (flatpack)\"" + "The default value is something like \"%.0s%u (pacman), %u (flatpack)\"" ); } @@ -390,7 +389,10 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con else if(strcasecmp(key, "--packages-combined") == 0) instance->config.packagesCombined = optionParseBoolean(value); else if(strcasecmp(key, "--packages-combined-names") == 0) + { + instance->config.packagesCombined = true; instance->config.packagesCombinedNames = optionParseBoolean(value); + } else if(strcasecmp(key, "--packages-pacman") == 0) instance->config.packagesPacman = optionParseBoolean(value); else if(strcasecmp(key, "--packages-flatpak") == 0) diff --git a/src/modules/packages.c b/src/modules/packages.c index b7868bf14..9e501478a 100644 --- a/src/modules/packages.c +++ b/src/modules/packages.c @@ -38,15 +38,15 @@ void ffPrintPackages(FFinstance* instance) ffPrintLogoAndKey(instance, "Packages"); + if(instance->config.packagesFormat[0] != '\0') + { + printf(instance->config.packagesFormat, all, pacman, flatpak, all); + putchar('\n'); + return; + } + if(instance->config.packagesCombined) { - if(instance->config.packagesFormat[0] != '\0') - { - printf(instance->config.packagesFormat, all); - putchar('\n'); - return; - } - printf("%u", all); if(instance->config.packagesCombinedNames) @@ -73,13 +73,6 @@ void ffPrintPackages(FFinstance* instance) } else { - if(instance->config.packagesFormat[0] != '\0') - { - printf(instance->config.packagesFormat, pacman, flatpak); - putchar('\n'); - return; - } - #define FF_PRINT_PACKAGE(name) \ if(name > 0) \ { \