Merge branch 'main' into main

This commit is contained in:
TheDarkBug 2021-03-07 00:21:20 +01:00 committed by GitHub
commit 75cc6a77eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 17 deletions

1
.gitignore vendored
View file

@ -1 +1,2 @@
uwufetch uwufetch
res/*

View file

@ -15,3 +15,7 @@ install:
uninstall: uninstall:
sudo rm $(INSTALL_DIR)$(NAME) sudo rm $(INSTALL_DIR)$(NAME)
rm -rf ~/.config/uwufetch rm -rf ~/.config/uwufetch
debug: build
clear
./uwufetch

View file

@ -4,7 +4,7 @@ A meme system info tool for Linux, based on nyan/UwU trend on r/linuxmasterrace.
## Currently supported distros ## Currently supported distros
Nyarch Linuwu, Nyartix Linuwu, Debinyan, Fedowa, Myanjaro. Nyarch Linuwu, Nyartix Linuwu, Debinyan, Fedowa, Myanjawo.
## Building and installation ## Building and installation

View file

@ -28,14 +28,31 @@ void get_info();
void print_ascii(); void print_ascii();
void print_info(); void print_info();
void print_image(); void print_image();
void usage(char*);
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
int opt = getopt(argc, argv, "adhi");
get_info(); get_info();
//sprintf(version_name, "%s", "manjaro"); // a debug thing //sprintf(version_name, "%s", "artix"); // a debug thing
//char c = getopt(argc, argv, "adhi"); // things for the future switch (opt) {
print_ascii(); case 'd':
//system("viu -t -w 18 -h 8 $HOME/.config/uwufetch/arch.png"); // other things for the future usage(argv[0]);
return 1;
case 'h':
usage(argv[0]);
return 0;
case 'a':
print_ascii();
break;
case 'i':
print_image();
break;
default:
print_ascii();
break;
}
print_info(); print_info();
printf("%i\n", opt);
} }
int pkgman() { // this is just a function that returns the total of installed packages int pkgman() { // this is just a function that returns the total of installed packages
@ -61,16 +78,16 @@ int pkgman() { // this is just a function that returns the total of installed pa
fscanf(file[7], "%d", &xbps); fscanf(file[7], "%d", &xbps);
for (int i = 0; i < 8; i++) fclose(file[i]); for (int i = 0; i < 8; i++) fclose(file[i]);
if (apt > 0) { total += apt; snprintf(pkgman_name, 64, "(%s)", "apt"); } if (apt > 0) { total += apt; strcat(pkgman_name, "(apt)"); }
if (dnf > 0) { total += dnf; snprintf(pkgman_name, 64, "(%s)", "dnf"); } if (dnf > 0) { total += dnf; strcat(pkgman_name, "(dnf)"); }
if (emerge > 0) { total += emerge; snprintf(pkgman_name, 64, "(%s)", "emerge"); } if (emerge > 0) { total += emerge; strcat(pkgman_name, "(emerge)"); }
if (flatpak > 0) { total += flatpak; snprintf(pkgman_name, 64, "(%s)", "flatpak"); } if (flatpak > 0) { total += flatpak; strcat(pkgman_name, "(flatpak)"); }
if (nix > 0) { total += nix; snprintf(pkgman_name, 64, "(%s)", "nix"); } if (nix > 0) { total += nix; strcat(pkgman_name, "(nix)"); }
if (pacman > 0) { total += pacman; snprintf(pkgman_name, 64, "(%s)", "pacman"); } if (pacman > 0) { total += pacman; strcat(pkgman_name, "(pacman)"); }
if (rpm > 0) { total += rpm; snprintf(pkgman_name, 64, "(%s)", "rpm"); } if (rpm > 0) { total += rpm; strcat(pkgman_name, "(rpm)"); }
if (xbps > 0) { total += xbps; snprintf(pkgman_name, 64, "(%s)", "xbps"); } if (xbps > 0) { total += xbps; strcat(pkgman_name, "(xbps)"); }
return total; return total;
} }
void print_info() { // print collected info void print_info() { // print collected info
@ -138,7 +155,7 @@ void print_ascii() { // prints logo of the given system. distributions listed al
" -_\n" " -_\n"
" --_\n", RED); " --_\n", RED);
} else if (strcmp(version_name, "fedora") == 0) { } else if (strcmp(version_name, "fedora") == 0) {
sprintf(version_name, "%s", "Fedowora"); sprintf(version_name, "%s", "Fedowoa");
printf( "\033[2;9H%s_____\n" printf( "\033[2;9H%s_____\n"
" / __)%s\\\n" " / __)%s\\\n"
" %s> %s| / %s<%s\\ \\\n" " %s> %s| / %s<%s\\ \\\n"
@ -157,7 +174,7 @@ void print_ascii() { // prints logo of the given system. distributions listed al
" ( _-\n" " ( _-\n"
" \\____-\n", MAGENTA, WHITE); " \\____-\n", MAGENTA, WHITE);
} else if (strcmp(version_name, "manjaro") == 0) { } else if (strcmp(version_name, "manjaro") == 0) {
sprintf(version_name, "%s", "Myanjaro"); sprintf(version_name, "%s", "Myanjawo");
printf( " \u25b3 \u25b3 \u25e0\u25e0\u25e0\u25e0\n" printf( " \u25b3 \u25b3 \u25e0\u25e0\u25e0\u25e0\n"
" \e[0;42m \e[0m \e[0;42m \e[0m\n" " \e[0;42m \e[0m \e[0;42m \e[0m\n"
" \e[0;42m \e[0m\e[0;42m\e[1;30m > w < \e[0m\e[0;42m \e[0m \e[0;42m \e[0m\n" " \e[0;42m \e[0m\e[0;42m\e[1;30m > w < \e[0m\e[0;42m \e[0m \e[0;42m \e[0m\n"
@ -168,3 +185,20 @@ void print_ascii() { // prints logo of the given system. distributions listed al
" \e[0;42m \e[0m \e[0;42m \e[0m \e[0;42m \e[0m\n"); " \e[0;42m \e[0m \e[0;42m \e[0m \e[0;42m \e[0m\n");
} }
} }
void print_image() {
//printf("e[1;1H\e[2J");
char command[256];
sprintf(command, "viu -t -w 18 -h 8 $HOME/.config/uwufetch/%s.png", version_name);
system(command);
}
void usage(char* arg) {
printf("Usage: %s <args>\n"
" -a, --ascii prints logo as ascii text (default)\n"
" -d, --distro %slets you choose the logo to print%s\n"
" -h, --help prints this help page\n"
" -i, --image prints logo as image\n"
" %sworks in few terminals\n"
" <cat README.md> for more info%s\n",
arg, YELLOW, NORMAL, BLUE, NORMAL);
}