Skip to content
This repository was archived by the owner on Sep 3, 2024. It is now read-only.

Commit e04c095

Browse files
Added distro flag
1 parent e2148f2 commit e04c095

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

src/fetch.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,14 @@ void print_process(string art,string color_name)
436436
/**
437437
* Utility to print ascii art of Distro
438438
*/
439-
void print(string color_name)
439+
void print(string color_name,string distro_name)
440440
{
441-
string os = getOS("/etc/os-release");
441+
string os = distro_name;
442+
443+
if (distro_name == "def")
444+
{
445+
os = getOS("/etc/os-release");
446+
}
442447

443448
map<string, string> ascii_arts = {{"Ubuntu", "ubuntu.ascii"},
444449
{"Debian", "debian.ascii"},
@@ -481,4 +486,8 @@ void print(string color_name)
481486
return;
482487
}
483488
}
489+
490+
print_process("linux.ascii",color_name);
491+
492+
return;
484493
}

src/fetch.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ vector<string> getGPU();
5555

5656
string getPackages();
5757

58-
void print(string color);
58+
void print(string color,string distro_name);
5959

6060
// util.cpp
6161

src/main.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ int main(int argc, char *argv[])
1515
{
1616
bool test_mode = false;
1717
string color_name = "def"s;
18+
string distro_name = "def"s;
1819

1920
int opt;
20-
while((opt = getopt(argc, argv, "ta:")) != -1)
21+
while((opt = getopt(argc, argv, "ta:d:")) != -1)
2122
{
2223
switch(opt)
2324
{
@@ -27,6 +28,9 @@ int main(int argc, char *argv[])
2728
case 'a':
2829
color_name = string(optarg);
2930
break;
31+
case 'd':
32+
distro_name = string(optarg);
33+
break;
3034
default:
3135
return 1;
3236
}
@@ -45,7 +49,7 @@ int main(int argc, char *argv[])
4549
return 1;
4650
}
4751

48-
print(color_name);
52+
print(color_name,distro_name);
4953
DisplayInfo();
5054

5155
return 0;

0 commit comments

Comments
 (0)