This repository has been archived by the owner on Jan 4, 2025. It is now read-only.
forked from JulianChow94/Windows-screenFetch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwindows-screenfetch-fast.psm1
74 lines (61 loc) · 1.95 KB
/
windows-screenfetch-fast.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
64
65
66
67
68
69
70
71
72
73
<#
.Synopsis
Windows-screenFetch but faster.
.Description
This is a fork of [Windows-screenFetch](https://github.com/JulianChow94/Windows-screenFetch) that aims to be faster.
.Parameter Distro
Cam be used to switch logo.
.Example
Screenfetch
#>
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
$NumLines = (($SystemInfoCollection.Count, $AsciiArt.Count) | Measure-Object -Maximum).Maximum;
for ($line = 0; $line -lt $NumLines; $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];
}
}
}