mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Sync from upstream
This commit is contained in:
+1
-5
@@ -109,11 +109,7 @@ __fastfetch_completion()
|
||||
"--recache"
|
||||
"--show-errors"
|
||||
"--color-logo"
|
||||
"--battery-manufacturer"
|
||||
"--battery-model"
|
||||
"--battery-technology"
|
||||
"--battery-capacity"
|
||||
"--battery-status"
|
||||
"--print-remaining-logo"
|
||||
)
|
||||
|
||||
local FF_OPTIONS_STRING=(
|
||||
|
||||
@@ -30,6 +30,7 @@ void ffDefaultConfig(FFconfig* config)
|
||||
config->showErrors = false;
|
||||
config->recache = false;
|
||||
config->cacheSave = true;
|
||||
config->printRemainingLogo = true;
|
||||
|
||||
ffStrbufInit(&config->osFormat);
|
||||
ffStrbufInit(&config->hostFormat);
|
||||
@@ -57,6 +58,47 @@ void ffDefaultConfig(FFconfig* config)
|
||||
ffStrbufInitA(&config->libXrandr, 256);
|
||||
}
|
||||
|
||||
static void ffCleanup(FFinstance* instance)
|
||||
{
|
||||
ffStrbufDestroy(&instance->config.color);
|
||||
ffStrbufDestroy(&instance->config.seperator);
|
||||
|
||||
ffStrbufDestroy(&instance->config.osFormat);
|
||||
ffStrbufDestroy(&instance->config.hostFormat);
|
||||
ffStrbufDestroy(&instance->config.kernelFormat);
|
||||
ffStrbufDestroy(&instance->config.uptimeFormat);
|
||||
ffStrbufDestroy(&instance->config.packagesFormat);
|
||||
ffStrbufDestroy(&instance->config.shellFormat);
|
||||
ffStrbufDestroy(&instance->config.resolutionFormat);
|
||||
ffStrbufDestroy(&instance->config.deFormat);
|
||||
ffStrbufDestroy(&instance->config.wmFormat);
|
||||
ffStrbufDestroy(&instance->config.themeFormat);
|
||||
ffStrbufDestroy(&instance->config.iconsFormat);
|
||||
ffStrbufDestroy(&instance->config.fontFormat);
|
||||
ffStrbufDestroy(&instance->config.terminalFormat);
|
||||
ffStrbufDestroy(&instance->config.termFontFormat);
|
||||
ffStrbufDestroy(&instance->config.cpuFormat);
|
||||
ffStrbufDestroy(&instance->config.gpuFormat);
|
||||
ffStrbufDestroy(&instance->config.memoryFormat);
|
||||
ffStrbufDestroy(&instance->config.diskFormat);
|
||||
ffStrbufDestroy(&instance->config.batteryFormat);
|
||||
ffStrbufDestroy(&instance->config.localeFormat);
|
||||
|
||||
ffStrbufDestroy(&instance->config.libPCI);
|
||||
ffStrbufDestroy(&instance->config.libX11);
|
||||
ffStrbufDestroy(&instance->config.libXrandr);
|
||||
|
||||
ffStrbufDestroy(&instance->state.terminal.value);
|
||||
}
|
||||
|
||||
void ffFinish(FFinstance* instance)
|
||||
{
|
||||
if(instance->config.printRemainingLogo)
|
||||
ffPrintRemainingLogo(instance);
|
||||
|
||||
ffCleanup(instance);
|
||||
}
|
||||
|
||||
void ffPrintKey(FFconfig* config, const char* key)
|
||||
{
|
||||
printf(FASTFETCH_TEXT_MODIFIER_BOLT"%s%s"FASTFETCH_TEXT_MODIFIER_RESET"%s", config->color.chars, key, config->seperator.chars);
|
||||
|
||||
+15
-8
@@ -42,14 +42,15 @@ static inline void printHelp()
|
||||
" --print-default-config: prints the default config and exits\n"
|
||||
"\n"
|
||||
"General options:\n"
|
||||
" --structure <structure>: sets the structure of the fetch. Must be a colon seperated list of keys\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"
|
||||
" --spacer <width>: sets the distance between logo and text\n"
|
||||
" -s <str>, --seperator <str>: sets the seperator between key and value. Default is a colon with a space\n"
|
||||
" -x <offset>, --offsetx <offset>: sets the x offset. Can be negative to cut the logo, but no more than logo width.\n"
|
||||
" --show-errors <?value>: print occuring errors\n"
|
||||
" -r <?value> --recache <?value>: if set to true, no cached values will be used\n"
|
||||
" --structure <structure>: sets the structure of the fetch. Must be a colon seperated list of keys\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"
|
||||
" --spacer <width>: sets the distance between logo and text\n"
|
||||
" -s <str>, --seperator <str>: sets the seperator between key and value. Default is a colon with a space\n"
|
||||
" -x <offset>, --offsetx <offset>: sets the x offset. Can be negative to cut the logo, but no more than logo width.\n"
|
||||
" --show-errors <?value>: print occuring errors\n"
|
||||
" -r <?value> --recache <?value>: if set to true, no cached values will be used\n"
|
||||
" --print-remaining-logo <?value>: print the remaining logo, if it is higher than the number of lines shown\n"
|
||||
"\n"
|
||||
"Logo options:\n"
|
||||
" -l <name>, --logo <name>: sets the shown logo. Also changes the main color accordingly\n"
|
||||
@@ -400,6 +401,8 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
|
||||
instance->config.showErrors = optionParseBoolean(value);
|
||||
else if(strcasecmp(key, "--color-logo") == 0)
|
||||
instance->config.colorLogo = optionParseBoolean(value);
|
||||
else if(strcasecmp(key, "--print-remaining-logo") == 0)
|
||||
instance->config.printRemainingLogo = optionParseBoolean(value);
|
||||
else if(strcasecmp(key, "--structure") == 0)
|
||||
optionParseString(key, value, &data->structure);
|
||||
else if(strcasecmp(key, "-l") == 0 || strcasecmp(key, "--logo") == 0)
|
||||
@@ -691,5 +694,9 @@ int main(int argc, const char** argv)
|
||||
|
||||
run(&instance, &data);
|
||||
|
||||
ffFinish(&instance);
|
||||
|
||||
ffStrbufDestroy(&data.structure);
|
||||
ffStrbufDestroy(&data.logoName);
|
||||
ffValuestoreDelete(&data.valuestore);
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ typedef struct FFconfig
|
||||
bool showErrors;
|
||||
bool recache;
|
||||
bool cacheSave; //This is only set to true when using arguments, because we dont want so save this values
|
||||
bool printRemainingLogo;
|
||||
|
||||
FFstrbuf osFormat;
|
||||
FFstrbuf hostFormat;
|
||||
@@ -125,11 +126,13 @@ void ffTrimTrailingWhitespace(char* buffer);
|
||||
bool ffPrintCachedValue(FFinstance* instance, const char* key);
|
||||
void ffPrintAndSaveCachedValue(FFinstance* instance, const char* key, const char* value);
|
||||
void ffParseFormatString(FFstrbuf* buffer, FFstrbuf* formatstr, uint32_t numArgs, ...);
|
||||
void ffFinish(FFinstance* instance);
|
||||
|
||||
//Logo functions
|
||||
void ffLoadLogoSet(FFconfig* config, const char* logo);
|
||||
void ffLoadLogo(FFconfig* config);
|
||||
void ffPrintLogoLine(FFinstance* instance);
|
||||
void ffPrintRemainingLogo(FFinstance* instance);
|
||||
|
||||
#ifndef FLASHFETCH_BUILD_FLASHFATCH
|
||||
void ffListLogos();
|
||||
|
||||
@@ -36,5 +36,6 @@ int main(int argc, char** argv)
|
||||
ffPrintBreak(&instance);
|
||||
ffPrintColors(&instance);
|
||||
|
||||
ffFinish(&instance);
|
||||
return 0;
|
||||
}
|
||||
@@ -230,6 +230,15 @@ void ffPrintLogoLine(FFinstance* instance)
|
||||
++instance->state.current_row;
|
||||
}
|
||||
|
||||
void ffPrintRemainingLogo(FFinstance* instance)
|
||||
{
|
||||
while(instance->state.current_row < instance->config.logo.height)
|
||||
{
|
||||
ffPrintLogoLine(instance);
|
||||
putchar('\n');
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef FASTFETCH_BUILD_FLASHFETCH
|
||||
|
||||
static FFlogo* getLogos(uint8_t* size, bool color)
|
||||
|
||||
Reference in New Issue
Block a user