From efc0322ed18ddba3738da00adf4837bfda4d8aa0 Mon Sep 17 00:00:00 2001 From: Linus Dierheimer Date: Sat, 27 Mar 2021 19:26:58 +0100 Subject: [PATCH] print default structure / modules --- completions/bash | 2 ++ src/fastfetch.c | 58 ++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 53 insertions(+), 7 deletions(-) diff --git a/completions/bash b/completions/bash index f83f4d546..0c99f83e8 100644 --- a/completions/bash +++ b/completions/bash @@ -99,6 +99,8 @@ __fastfetch_completion() "--list-logos" "--print-logos" "--print-default-config" + "--print-default-structure" + "--print-available-modules" ) local FF_OPTIONS_HELP=( diff --git a/src/fastfetch.c b/src/fastfetch.c index b128686ff..1b6ad1ad8 100644 --- a/src/fastfetch.c +++ b/src/fastfetch.c @@ -34,15 +34,17 @@ static inline void printHelp() "Usage: fastfetch \n" "\n" "Informative options:\n" - " -h, --help: shows this message and exits\n" - " -h , --help : shows help for a specific command and exits\n" - " -v --version: prints the version of fastfetch and exits\n" - " --list-logos: list available logos and exits\n" - " --print-logos: shows available logos and exits\n" - " --print-default-config: prints the default config and exits\n" + " -h, --help: shows this message and exits\n" + " -h , --help : shows help for a specific command and exits\n" + " -v --version: prints the version of fastfetch and exits\n" + " --list-logos: list available logos and exits\n" + " --print-logos: shows available logos and exits\n" + " --print-default-config: prints the default config and exits\n" + " --print-default-structure: prints the default stucture and exits\n" + " --print-available-modules: prints a list of available modules and exits\n" "\n" "General options:\n" - " --structure : sets the structure of the fetch. Must be a colon seperated list of keys\n" + " --structure : sets the structure of the fetch. Must be a colon seperated list of keys. Use --print-available-modules to show the default\n" " --set : hard set the value of an key\n" " -c , --color : sets the color of the keys. Must be a linux console color code (+)\n" " --spacing : sets the distance between logo and text\n" @@ -130,6 +132,38 @@ static inline void printCommandHelpFormat() ); } +static inline void printAvailableModules() +{ + puts( + "Battery\n" + "Break\n" + "Colors\n" + "CPU\n" + "DE\n" + "Disk\n" + "Font\n" + "GPU\n" + "Host\n" + "Icons\n" + "Kernel\n" + "Locale\n" + "Memory\n" + "OS\n" + "Packages\n" + "Resolution\n" + "Seperator\n" + "Shell\n" + "Terminal\n" + "TerminalFont\n" + "Theme\n" + "Title\n" + "Uptime\n" + "WM\n" + "\n" + "+ Additional defined by --set" + ); +} + static void constructAndPrintCommandHelpFormat(const char* name, const char* def, uint32_t numArgs, ...) { va_list argp; @@ -266,6 +300,16 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con puts(FASTFETCH_DEFAULT_CONFIG); exit(0); } + else if(strcasecmp(key, "--print-default-structure") == 0) + { + puts(FASTFETCH_DEFAULT_STRUCTURE); + exit(0); + } + else if(strcasecmp(key, "--print-available-modules") == 0) + { + printAvailableModules(); + exit(0); + } else if(strcasecmp(key, "--spacing") == 0) { if(value == NULL)