Updated print_image next step is adding images in res directory
This commit is contained in:
parent
ee22b5d581
commit
b39c1af276
2 changed files with 32 additions and 22 deletions
4
Makefile
4
Makefile
|
@ -9,13 +9,13 @@ build: uwufetch.c
|
||||||
|
|
||||||
install:
|
install:
|
||||||
sudo cp $(NAME) $(INSTALL_DIR)$(NAME)
|
sudo cp $(NAME) $(INSTALL_DIR)$(NAME)
|
||||||
mkdir ~/.config/uwufetch/
|
ls ~/.config/uwufetch 1> /dev/null || mkdir ~/.config/uwufetch/
|
||||||
cp res/* ~/.config/uwufetch/
|
cp res/* ~/.config/uwufetch/
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
sudo rm $(INSTALL_DIR)$(NAME)
|
sudo rm $(INSTALL_DIR)$(NAME)
|
||||||
rm -rf ~/.config/uwufetch
|
rm -rf ~/.config/uwufetch
|
||||||
|
|
||||||
debug: build
|
debug: build install
|
||||||
clear
|
clear
|
||||||
./uwufetch
|
./uwufetch
|
50
uwufetch.c
50
uwufetch.c
|
@ -31,26 +31,28 @@ void print_image();
|
||||||
void usage(char*);
|
void usage(char*);
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
int opt = getopt(argc, argv, "adhi");
|
int opt = 0;
|
||||||
get_info();
|
get_info();
|
||||||
//sprintf(version_name, "%s", "artix"); // a debug thing
|
//sprintf(version_name, "%s", "debian"); // a debug thing
|
||||||
switch (opt) {
|
|
||||||
case 'd':
|
while((opt = getopt(argc, argv, "a:hi")) != -1) {
|
||||||
usage(argv[0]);
|
switch(opt) {
|
||||||
return 1;
|
case 'a':
|
||||||
case 'h':
|
if (optarg) sprintf(version_name, "%s", optarg);
|
||||||
usage(argv[0]);
|
if (opt != 'i') print_ascii();
|
||||||
return 0;
|
break;
|
||||||
case 'a':
|
case 'i':
|
||||||
print_ascii();
|
if (optarg) sprintf(version_name, "%s", optarg);
|
||||||
break;
|
if (opt != 'a') print_image();
|
||||||
case 'i':
|
break;
|
||||||
print_image();
|
case 'h':
|
||||||
break;
|
usage(argv[0]);
|
||||||
default:
|
return 0;
|
||||||
print_ascii();
|
default:
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (argc == 1) print_ascii();
|
||||||
print_info();
|
print_info();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,6 +116,7 @@ void get_info() { // get all necessary info
|
||||||
fscanf(fos_rel,"%[^\n]", version_name);
|
fscanf(fos_rel,"%[^\n]", version_name);
|
||||||
fclose(fos_rel);
|
fclose(fos_rel);
|
||||||
|
|
||||||
|
// system info
|
||||||
if (uname(&sys_var) == -1) printf("There was some kind of error while getting the username\n");
|
if (uname(&sys_var) == -1) printf("There was some kind of error while getting the username\n");
|
||||||
if (sysinfo(&sys) == -1) printf("There was some kind of error while getting system info\n");
|
if (sysinfo(&sys) == -1) printf("There was some kind of error while getting system info\n");
|
||||||
|
|
||||||
|
@ -126,7 +129,7 @@ void get_info() { // get all necessary info
|
||||||
pkgs = pkgman();
|
pkgs = pkgman();
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_ascii() { // prints logo of the given system. distributions listed alphabetically.
|
void print_ascii() { // prints logo (as ascii art) of the given system. distributions listed alphabetically.
|
||||||
if (strcmp(version_name, "arch") == 0) {
|
if (strcmp(version_name, "arch") == 0) {
|
||||||
sprintf(version_name, "%s", "Nyarch Linuwu");
|
sprintf(version_name, "%s", "Nyarch Linuwu");
|
||||||
printf( "\033[3;9H%s/\\\n"
|
printf( "\033[3;9H%s/\\\n"
|
||||||
|
@ -184,11 +187,18 @@ 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() {
|
void print_image() { // prints logo (as an image) of the given system. distributions listed alphabetically.
|
||||||
//printf("e[1;1H\e[2J");
|
//printf("e[1;1H\e[2J");
|
||||||
char command[256];
|
char command[256];
|
||||||
sprintf(command, "viu -t -w 18 -h 8 $HOME/.config/uwufetch/%s.png", version_name);
|
sprintf(command, "viu -t -w 18 -h 8 $HOME/.config/uwufetch/%s.png", version_name);
|
||||||
system(command);
|
system(command);
|
||||||
|
|
||||||
|
if (strcmp(version_name, "arch") == 0) sprintf(version_name, "%s", "Nyarch Linuwu");
|
||||||
|
if (strcmp(version_name, "artix") == 0) sprintf(version_name, "%s", "Nyartix Linuwu");
|
||||||
|
if (strcmp(version_name, "debian") == 0) sprintf(version_name, "%s", "Debinyan");
|
||||||
|
if (strcmp(version_name, "fedora") == 0) sprintf(version_name, "%s", "Fedowa");
|
||||||
|
if (strcmp(version_name, "gentoo") == 0) sprintf(version_name, "%s", "GentOwO");
|
||||||
|
if (strcmp(version_name, "manjaro") == 0) sprintf(version_name, "%s", "Myanjawo");
|
||||||
}
|
}
|
||||||
|
|
||||||
void usage(char* arg) {
|
void usage(char* arg) {
|
||||||
|
|
Loading…
Reference in a new issue