Added -l option to list available distributions.
This commit is contained in:
parent
fd71120e34
commit
0725a9cbb3
1 changed files with 12 additions and 4 deletions
16
uwufetch.c
16
uwufetch.c
|
@ -26,6 +26,7 @@ int ram_max, pkgs, a_i_flag = 0;
|
||||||
char user[32], host[253], shell[64], version_name[64], cpu_model[256], pkgman_name[64];
|
char user[32], host[253], shell[64], version_name[64], cpu_model[256], pkgman_name[64];
|
||||||
int pkgman();
|
int pkgman();
|
||||||
void get_info();
|
void get_info();
|
||||||
|
void list();
|
||||||
void print_ascii();
|
void print_ascii();
|
||||||
void print_info();
|
void print_info();
|
||||||
void print_image();
|
void print_image();
|
||||||
|
@ -34,7 +35,7 @@ void usage(char*);
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
int opt = 0;
|
int opt = 0;
|
||||||
get_info();
|
get_info();
|
||||||
while((opt = getopt(argc, argv, "ad:hi")) != -1) {
|
while((opt = getopt(argc, argv, "ad:hil")) != -1) {
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
case 'a':
|
case 'a':
|
||||||
a_i_flag = 0;
|
a_i_flag = 0;
|
||||||
|
@ -48,6 +49,9 @@ int main(int argc, char *argv[]) {
|
||||||
case 'i':
|
case 'i':
|
||||||
a_i_flag = 1;
|
a_i_flag = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'l':
|
||||||
|
list(argv[0]);
|
||||||
|
return 0;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -152,10 +156,16 @@ void get_info() { // get all necessary info
|
||||||
pkgs = pkgman();
|
pkgs = pkgman();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void list(char* arg) { // prints distribution list
|
||||||
|
printf("%s -d <options>\n"
|
||||||
|
"Available distributions:\n"
|
||||||
|
"%s%sarch, artix, %sdebian, %sfedora, %sgentoo, %smanjaro, \"manjaro-arm\", android, %sopenbsd, %sfreebsd%s\n",
|
||||||
|
arg, BOLD, BLUE, RED, CYAN, MAGENTA, GREEN, YELLOW, RED, NORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
void print_ascii() { // prints logo (as ascii art) of the given system. distributions listed alphabetically.
|
void print_ascii() { // prints logo (as ascii art) of the given system. distributions listed alphabetically.
|
||||||
|
|
||||||
// linux
|
// linux
|
||||||
|
|
||||||
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[1E\033[8C%s/\\\n"
|
printf( "\033[1E\033[8C%s/\\\n"
|
||||||
|
@ -226,8 +236,6 @@ void print_ascii() { // prints logo (as ascii art) of the given system. distribu
|
||||||
printf( "\n\n\nascii icon\n nedds to be\n added\n\n\n\n\n");
|
printf( "\n\n\nascii icon\n nedds to be\n added\n\n\n\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// BSD
|
// BSD
|
||||||
else if (strcmp(version_name, "openbsd") == 0) {
|
else if (strcmp(version_name, "openbsd") == 0) {
|
||||||
sprintf(version_name, "%s", "OwOpenBSD");
|
sprintf(version_name, "%s", "OwOpenBSD");
|
||||||
|
|
Loading…
Reference in a new issue