print default structure / modules

This commit is contained in:
Linus Dierheimer
2021-03-27 19:26:58 +01:00
parent b3c3614b6c
commit efc0322ed1
2 changed files with 53 additions and 7 deletions
+2
View File
@@ -99,6 +99,8 @@ __fastfetch_completion()
"--list-logos"
"--print-logos"
"--print-default-config"
"--print-default-structure"
"--print-available-modules"
)
local FF_OPTIONS_HELP=(
+51 -7
View File
@@ -34,15 +34,17 @@ static inline void printHelp()
"Usage: fastfetch <options>\n"
"\n"
"Informative options:\n"
" -h, --help: shows this message and exits\n"
" -h <command>, --help <command>: 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 <command>, --help <command>: 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 <structure>: sets the structure of the fetch. Must be a colon seperated list of keys\n"
" --structure <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 <key=value>: hard set the value of an key\n"
" -c <color>, --color <color>: sets the color of the keys. Must be a linux console color code (+)\n"
" --spacing <width>: 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)