-
Notifications
You must be signed in to change notification settings - Fork 0
/
wfetch.psm1
59 lines (50 loc) · 1.68 KB
/
wfetch.psm1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
Function wfetch($distro)
{
$AsciiArt = "";
if (-not $distro)
{
$AsciiArt = . Get-WindowsArt;
}
if (([string]::Compare($distro, "mac", $true) -eq 0) -or
([string]::Compare($distro, "macOS", $true) -eq 0) -or
([string]::Compare($distro, "osx", $true) -eq 0)) {
$AsciiArt = . Get-MacArt;
}
else
{
$AsciiArt = . Get-WindowsArt;
}
$SystemInfoCollection = . Get-SystemSpecifications;
$LineToTitleMappings = . Get-LineToTitleMappings;
# Iterate over all lines from the SystemInfoCollection to display all information
for ($line = 0; $line -lt $SystemInfoCollection.Count; $line++)
{
if (($AsciiArt[$line].Length) -eq 0)
{
# Write some whitespaces to sync the left spacing with the asciiart.
Write-Host " " -f Cyan -NoNewline;
}
else
{
Write-Host $AsciiArt[$line] -f Cyan -NoNewline;
}
Write-Host $LineToTitleMappings[$line] -f Blue -NoNewline;
if ($line -eq 1)
{
Write-Host $SystemInfoCollection[$line] -f DarkYellow;
}
elseif ($SystemInfoCollection[$line] -like '*:*')
{
$Seperator = ":";
$Splitted = $SystemInfoCollection[$line].Split($seperator);
$Title = $Splitted[0] + $Seperator;
$Content = $Splitted[1];
Write-Host $Title -f DarkYellow -NoNewline;
Write-Host $Content;
}
else
{
Write-Host $SystemInfoCollection[$line];
}
}
}