Merge pull request #115 from Guaxinim5573/main

[NEW-FEATURE] Move ascii arts to own file
This commit is contained in:
TheDarkBug 2021-07-31 21:56:31 +02:00 committed by GitHub
commit 833a2234c7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 269 additions and 2 deletions

View file

@ -33,7 +33,7 @@ debug:
install: build
cp $(NAME) $(DESTDIR)$(PREFIX)/$(NAME)
ls $(DESTDIR)$(LIBDIR)/uwufetch > /dev/null || mkdir $(DESTDIR)$(LIBDIR)/uwufetch
cp res/* $(DESTDIR)$(LIBDIR)/uwufetch
cp -r res/* $(DESTDIR)$(LIBDIR)/uwufetch
cp ./$(NAME).1.gz $(DESTDIR)$(MANDIR)/
uninstall:

View file

@ -0,0 +1,8 @@
△ △ ◠◠◠◠
{BACKGROUND_GREEN} {NORMAL} {BACKGROUND_GREEN} {NORMAL}
{BACKGROUND_GREEN} {NORMAL}{BACKGROUND_GREEN}{BLACK} > ω < {NORMAL}{BACKGROUND_GREEN} {NORMAL} {BACKGROUND_GREEN} {NORMAL}
{BACKGROUND_GREEN} {NORMAL} {BACKGROUND_GREEN} {NORMAL}
{BACKGROUND_GREEN} {NORMAL} {BACKGROUND_GREEN} {NORMAL} {BACKGROUND_GREEN} {NORMAL}
{BACKGROUND_GREEN} {NORMAL} {BACKGROUND_GREEN} {NORMAL} {BACKGROUND_GREEN} {NORMAL}
{BACKGROUND_GREEN} {NORMAL} {BACKGROUND_GREEN} {NORMAL} {BACKGROUND_GREEN} {NORMAL}
{BACKGROUND_GREEN} {NORMAL} {BACKGROUND_GREEN} {NORMAL} {BACKGROUND_GREEN} {NORMAL}

8
res/ascii/alpine.txt Normal file
View file

@ -0,0 +1,8 @@
{BLUE}. .___.
/ \/ \ /
/OωO\ɛU\/ __
/ \ \__/ \
/ \ \

8
res/ascii/android.txt Normal file
View file

@ -0,0 +1,8 @@
{GREEN}\ _------_ /
/ \
| {RED}~ {GREEN}> ω < {RED}~ {GREEN}|
------------

8
res/ascii/arch.txt Normal file
View file

@ -0,0 +1,8 @@
{BLUE} /\
/ \
/\ \
/ > ω <\
/ __ \
/ __| |__-\
/_-'' ''-_\

8
res/ascii/artix.txt Normal file
View file

@ -0,0 +1,8 @@
{BLUE} /\
/ \
/`'.,\
/• w • \
/ ,`\
/ ,.'`. \
/.,'` `'.\

8
res/ascii/debian.txt Normal file
View file

@ -0,0 +1,8 @@
{RED} ______
/ ___ \
| / OωO |
| \____-
-_
--_\

View file

@ -0,0 +1,7 @@
{MAGENTA} /\
{RED}/{MAGENTA}/ \{BLUE}\
{RED}/{MAGENTA}/>ω<\{BLUE}\
{RED}/{MAGENTA}/ \ {BLUE}\
{RED}/ {MAGENTA}/ _) {BLUE})
{RED}/_{MAGENTA}/___-- {BLUE}___-
/____---

8
res/ascii/fedora.txt Normal file
View file

@ -0,0 +1,8 @@
{BLUE}_____
/ __){CYAN}\
{WHITE}> {BLUE}| / {WHITE}<{CYAN}\ \
__{BLUE}_| {CYAN}ω{BLUE}|_{CYAN}_/ /
/ {BLUE}(_ _){CYAN}_/
/ / {BLUE}| |
{CYAN}\ \{BLUE}__/ |
{CYAN}\{BLUE}(_____/

8
res/ascii/freebsd.txt Normal file
View file

@ -0,0 +1,8 @@
{RED}/\,-'''''-,/\
\_) (_/
| \ / |
| O ω O |
; ;
'-_____-'

8
res/ascii/gentoo.txt Normal file
View file

@ -0,0 +1,8 @@
{MAGENTA}_-----_
( \\
\\ OωO \\
{WHITE} \\ )
/ _/
( _-
\\____-

8
res/ascii/gnu.txt Normal file
View file

@ -0,0 +1,8 @@
{WHITE},= {YELLOW},-_-. {WHITE}=.
((_/{YELLOW}){WHITE}U U{YELLOW}({WHITE}\_))
`-'{YELLOW}(. .){WHITE}`-'
{YELLOW}\{WHITE}w{YELLOW}/
¯

8
res/ascii/guix.txt Normal file
View file

@ -0,0 +1,8 @@
{WHITE},= {YELLOW},-_-. {WHITE}=.
((_/{YELLOW}){WHITE}U U{YELLOW}({WHITE}\_))
`-'{YELLOW}(. .){WHITE}`-'
{YELLOW}\{WHITE}w{YELLOW}/
¯

7
res/ascii/linuxmint.txt Normal file
View file

@ -0,0 +1,7 @@
{GREEN} __/\____/\.
|{WHITE}.--. {GREEN}|
{WHITE}, {GREEN}¯| {WHITE}| UωU| {GREEN}|
{WHITE}|| {GREEN}| {WHITE}| | {GREEN}|
{WHITE} | {GREEN}| {WHITE}---- {GREEN}|
{WHITE} --{GREEN}'--------'

8
res/ascii/macos.txt Normal file
View file

@ -0,0 +1,8 @@
{GREEN} .:`
.--``--.
{YELLOW} ww OωO w
{RED} w w
{PINK} w w
{BLUE} www_-_www

8
res/ascii/manjaro.txt Normal file
View file

@ -0,0 +1,8 @@
△ △ ◠◠◠◠
{BACKGROUND_GREEN} {NORMAL} {BACKGROUND_GREEN} {NORMAL}
{BACKGROUND_GREEN} {NORMAL}{BACKGROUND_GREEN}{BLACK} > ω < {NORMAL}{BACKGROUND_GREEN} {NORMAL} {BACKGROUND_GREEN} {NORMAL}
{BACKGROUND_GREEN} {NORMAL} {BACKGROUND_GREEN} {NORMAL}
{BACKGROUND_GREEN} {NORMAL} {BACKGROUND_GREEN} {NORMAL} {BACKGROUND_GREEN} {NORMAL}
{BACKGROUND_GREEN} {NORMAL} {BACKGROUND_GREEN} {NORMAL} {BACKGROUND_GREEN} {NORMAL}
{BACKGROUND_GREEN} {NORMAL} {BACKGROUND_GREEN} {NORMAL} {BACKGROUND_GREEN} {NORMAL}
{BACKGROUND_GREEN} {NORMAL} {BACKGROUND_GREEN} {NORMAL} {BACKGROUND_GREEN} {NORMAL}

8
res/ascii/openbsd.txt Normal file
View file

@ -0,0 +1,8 @@
{YELLOW} ______
\- -/ {RED}♥
{YELLOW}\_/ \
| {WHITE}> < {YELLOW}|
|_ < {LPINK}// {WHITE}ω {LPINK}//
{YELLOW}/ \ /
/-________-\

View file

@ -0,0 +1,8 @@
{GREEN}|\----/|
_ / {WHITE}O O{GREEN}\
__. ω /
'----'

7
res/ascii/pop.txt Normal file
View file

@ -0,0 +1,7 @@
{BLUE} |\.-----./|
|/ \|
| > < |
| {LPINK}~ {WHITE}P! {LPINK}~ {BLUE}|
_ ---\ ω /
\_/ '-----'

7
res/ascii/raspbian.txt Normal file
View file

@ -0,0 +1,7 @@
{GREEN} __ __
(_\)(/_)
{RED}(>(__)<)
(_(_)(_)_)
(_(__)_)
(__)

8
res/ascii/slackware.txt Normal file
View file

@ -0,0 +1,8 @@
{MAGENTA}|\.-----./|
|/ \|
| > < |
| {LPINK}~ {WHITE}S {LPINK}~ {MAGENTA}|
_ ---\ ω /
\_/ '-----'

8
res/ascii/solus.txt Normal file
View file

@ -0,0 +1,8 @@
{WHITE}|\.-----./|
| \ / |
|/ > <\ |
|{BLUE}_{LPINK}~{BLUE}_____{LPINK}~{WHITE}\|
{BLUE}_ ---\ {WHITE}ω {BLUE}/
\_/ '-----'

7
res/ascii/ubuntu.txt Normal file
View file

@ -0,0 +1,7 @@
{LPINK} _
{PINK}◣{LPINK}__(_){PINK}◢{LPINK}
_/ --- \
(_) |>ω<| |
\ --- _/
{PINK}C__/{LPINK}---(_)

7
res/ascii/unknown.txt Normal file
View file

@ -0,0 +1,7 @@
{WHITE} ._.--._.
\|>{YELLOW}_{WHITE}< |/
|{YELLOW}:_/{WHITE} |
// \ \ ?
(| | ) /
{YELLOW}/'\_ _/`\{WHITE}-
{YELLOW}\___)=(___/

8
res/ascii/void.txt Normal file
View file

@ -0,0 +1,8 @@
{GREEN} |\_____/|
_\____ |
| \ \ |
| | {WHITE}ÒωÓ {GREEN}| | ,
| \_____\_|-, |
-_______\ \_/

9
res/ascii/windows.txt Normal file
View file

@ -0,0 +1,9 @@
{BLUE}MMMMMMM MMMMMMM
M ^ M M ^ M
M M M M
MMMMMMM MMMMMMM
MMMMMMM MMMMMMM
M W W W M
M WW WW M
MMMMMMM MMMMMMM

View file

@ -101,7 +101,9 @@ int pkgman();
void parse_config();
void get_info();
void list();
void replace(char *original, char *search, char *replacer);
void print_ascii();
void print_unknown_ascii();
void print_info();
void print_image();
void usage(char *);
@ -667,9 +669,74 @@ void list(char *arg)
NORMAL, BLUE, BLUE, PINK, MAGENTA, WHITE, GREEN, YELLOW, BLUE, WHITE); // Other/spare distributions colors
}
/*
This replaces all terms in a string with another term.
replace("Hello World!", "World", "everyone")
This returns "Hello everyone!".
*/
void replace(char *original, char *search, char *replacer) {
char buffer[1024];
char *ch;
if(!(ch = strstr(original, search))) return;
strncpy(buffer, original, ch-original);
buffer[ch-original] = 0;
sprintf(buffer+(ch - original), "%s%s", replacer, ch + strlen(search));
original[0] = 0;
strcpy(original, buffer);
return replace(original, search, replacer);
}
void print_ascii()
{ // prints logo (as ascii art) of the given system. distributions listed alphabetically.
printf("\n");
FILE *file;
char ascii_file[1024];
// First tries to get ascii art file from local directory. Good when modifying these files.
sprintf(ascii_file, "./res/ascii/%s.txt", version_name);
file = fopen(ascii_file, "r");
// Now tries to get file from normal directory
if(!file) {
if(strcmp(version_name, "android") == 0) {
sprintf(ascii_file, "/data/data/com.termux/files/usr/lib/uwufetch/ascii/%s.txt", version_name);
} else {
sprintf(ascii_file, "/usr/lib/uwufetch/ascii/%s.txt", version_name);
}
file = fopen(ascii_file, "r");
if(!file) {
// Prevent infinite loops
if(strcmp(version_name, "unknown") == 0) {
printf("No\nunknown\nascii\nfile\n\n\n\n");
return;
}
sprintf(version_name, "unknown");
return print_ascii();
}
}
char line[256];
while(fgets(line, 256, file)) {
replace(line, "{NORMAL}", NORMAL);
replace(line, "{BOLD}", BOLD);
replace(line, "{BLACK}", BLACK);
replace(line, "{RED}", RED);
replace(line, "{GREEN}", GREEN);
replace(line, "{YELLOW}", YELLOW);
replace(line, "{BLUE}", BLUE);
replace(line, "{MAGENTA}", MAGENTA);
replace(line, "{CYAN}", CYAN);
replace(line, "{WHITE}", WHITE);
replace(line, "{PINK}", PINK);
replace(line, "{LPINK}", LPINK);
// For manjaro
replace(line, "{BACKGROUND_GREEN}", "\e[0;42m");
printf(line);
}
// Always set color to NORMAL, so there's no need to do this in every ascii file.
printf(NORMAL);
fclose(file);
/*
// linux
if (strcmp(version_name, "alpine") == 0)
{
@ -915,7 +982,12 @@ void print_ascii()
" (| | ) /\n"
" %s/'\\_ _/`\\%s-\n"
" %s\\___)=(___/\n\n",
WHITE, YELLOW, WHITE, YELLOW, WHITE, YELLOW, WHITE, YELLOW);
WHITE, YELLOW, WHITE, YELLOW, WHITE, YELLOW, WHITE, YELLOW);*/
}
void print_unknown_ascii() {
printf("\n\n\n\n\nidk man\n");
return;
}
void print_image()