forked from JulianChow94/Windows-screenFetch
-
Notifications
You must be signed in to change notification settings - Fork 1
/
windows-screenfetch.psm1
64 lines (52 loc) · 1.67 KB
/
windows-screenfetch.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
60
61
62
63
#### Screenfetch for powershell
#### Author Julian Chow
Function Screenfetch($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 Red -NoNewline;
if ($line -eq 0)
{
Write-Host $SystemInfoCollection[$line] -f Red;
}
elseif ($SystemInfoCollection[$line] -like '*:*')
{
$Seperator = ":";
$Splitted = $SystemInfoCollection[$line].Split($seperator);
$Title = $Splitted[0] + $Seperator;
$Content = $Splitted[1];
Write-Host $Title -f Red -NoNewline;
Write-Host $Content;
}
else
{
Write-Host $SystemInfoCollection[$line];
}
}
}