mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-13 02:42:09 +02:00
Fix autocompletion of logos
This commit is contained in:
+1
-1
@@ -49,7 +49,7 @@ __fastfetch_complete_path()
|
||||
|
||||
__fastfetch_complete_logo()
|
||||
{
|
||||
COMPREPLY=($(compgen -W "$(fastfetch --list-logos)" -- "$CURRENT_WORD"))
|
||||
COMPREPLY=($(compgen -W "$(fastfetch --list-logos-autocompletion)" -- "$CURRENT_WORD"))
|
||||
}
|
||||
|
||||
__fastfetch_complete_option()
|
||||
|
||||
+17
-6
@@ -481,11 +481,11 @@ static FFlogo* getLogoVoid()
|
||||
FF_LOGO_RETURN
|
||||
}
|
||||
|
||||
typedef FFlogo*(*getLogoMethod)();
|
||||
typedef FFlogo*(*GetLogoMethod)();
|
||||
|
||||
static getLogoMethod* getLogoMethods()
|
||||
static GetLogoMethod* getLogoMethods()
|
||||
{
|
||||
static getLogoMethod logoMethods[] = {
|
||||
static GetLogoMethod logoMethods[] = {
|
||||
getLogoNone,
|
||||
getLogoUnknown,
|
||||
getLogoArch,
|
||||
@@ -525,7 +525,7 @@ static bool logoHasName(FFlogo* logo, const char* name)
|
||||
|
||||
static bool loadLogoSet(FFinstance* instance, const char* name)
|
||||
{
|
||||
getLogoMethod* logoMethod = getLogoMethods();
|
||||
GetLogoMethod* logoMethod = getLogoMethods();
|
||||
|
||||
while(*logoMethod != NULL)
|
||||
{
|
||||
@@ -743,7 +743,7 @@ void ffPrintRemainingLogo(FFinstance* instance)
|
||||
|
||||
void ffPrintLogos(FFinstance* instance)
|
||||
{
|
||||
getLogoMethod* methods = getLogoMethods();
|
||||
GetLogoMethod* methods = getLogoMethods();
|
||||
|
||||
while(*methods != NULL)
|
||||
{
|
||||
@@ -757,7 +757,7 @@ void ffPrintLogos(FFinstance* instance)
|
||||
|
||||
void ffListLogos()
|
||||
{
|
||||
getLogoMethod* methods = getLogoMethods();
|
||||
GetLogoMethod* methods = getLogoMethods();
|
||||
|
||||
while(*methods != NULL)
|
||||
{
|
||||
@@ -777,4 +777,15 @@ void ffListLogos()
|
||||
}
|
||||
}
|
||||
|
||||
void ffListLogosForAutocompletion()
|
||||
{
|
||||
GetLogoMethod* methods = getLogoMethods();
|
||||
|
||||
while(*methods != NULL)
|
||||
{
|
||||
printf("%s\n", (*methods)()->names[0]);
|
||||
++methods;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -515,6 +515,11 @@ static void parseOption(FFinstance* instance, FFdata* data, const char* key, con
|
||||
ffListLogos();
|
||||
exit(0);
|
||||
}
|
||||
else if(strcasecmp(key, "--list-logos-autocompletion") == 0)
|
||||
{
|
||||
ffListLogosForAutocompletion();
|
||||
exit(0);
|
||||
}
|
||||
else if(strcasecmp(key, "--print-logos") == 0)
|
||||
{
|
||||
ffPrintLogos(instance);
|
||||
|
||||
@@ -315,6 +315,7 @@ void ffPrintRemainingLogo(FFinstance* instance);
|
||||
#ifndef FASTFETCH_BUILD_FLASHFATCH
|
||||
void ffPrintLogos(FFinstance* instance);
|
||||
void ffListLogos();
|
||||
void ffListLogosForAutocompletion();
|
||||
#endif
|
||||
|
||||
//common/format.c
|
||||
|
||||
Reference in New Issue
Block a user