-
Notifications
You must be signed in to change notification settings - Fork 47
/
windows-screenfetch.psm1
60 lines (47 loc) · 1.53 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
#### 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;
if ($SystemInfoCollection.Count -gt $AsciiArt.Count)
{
Write-Error "System Specs occupies more lines than the Ascii Art resource selected"
}
for ($line = 0; $line -lt $AsciiArt.Count; $line++)
{
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];
}
}
}