Skip to content

Commit fa1aeec

Browse files
authored
Add files via upload
1 parent 7bad628 commit fa1aeec

File tree

6 files changed

+171
-0
lines changed

6 files changed

+171
-0
lines changed

Art.psm1

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Function Get-WindowsArt()
2+
{
3+
[string[]] $ArtArray =
4+
" ..... ",
5+
" .. :::::::: ",
6+
"..:::::: :::::::: ",
7+
":::::::: :::::::: ",
8+
"........ ........ ",
9+
":::::::: :::::::: ",
10+
" '''':: :::::::: ",
11+
" ''''' ";
12+
return $ArtArray;
13+
}
14+

Data.psm1

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
Function Get-SystemSpecifications()
2+
{
3+
4+
$UserInfo = Get-UserInformation;
5+
$OS = Get-OS;
6+
$Kernel = Get-Kernel;
7+
$Uptime = Get-Uptime;
8+
$Shell = Get-Shell;
9+
$RAM = Get-RAM;
10+
$Blank = Get-blank;
11+
12+
13+
[System.Collections.ArrayList] $SystemInfoCollection =
14+
$Blank,
15+
$UserInfo,
16+
$OS,
17+
$Kernel,
18+
$RAM,
19+
$Uptime,
20+
$Shell,
21+
$Blank,
22+
$Blank,
23+
$Blank;
24+
25+
26+
27+
return $SystemInfoCollection;
28+
}
29+
30+
Function Get-LineToTitleMappings()
31+
{
32+
$TitleMappings = @{
33+
1 = "";
34+
2 = "OS: ";
35+
3 = "Kernel: ";
36+
4 = "Memory: ";
37+
5 = "Uptime: ";
38+
6 = "Shell: ";
39+
40+
};
41+
42+
return $TitleMappings;
43+
}
44+
45+
Function Get-blank
46+
{
47+
""
48+
}
49+
Function Get-UserInformation()
50+
{
51+
return $env:USERNAME + "@" + [System.Net.Dns]::GetHostName();
52+
}
53+
54+
Function Get-OS()
55+
{
56+
return (Get-CimInstance Win32_OperatingSystem).Caption + " " +
57+
(Get-CimInstance Win32_OperatingSystem).OSArchitecture;
58+
}
59+
60+
Function Get-Kernel()
61+
{
62+
return (Get-CimInstance Win32_OperatingSystem).Version;
63+
}
64+
65+
Function Get-Uptime()
66+
{
67+
$Uptime = (([DateTime](Get-CimInstance Win32_OperatingSystem).LocalDateTime) -
68+
([DateTime](Get-CimInstance Win32_OperatingSystem).LastBootUpTime));
69+
70+
$FormattedUptime = $Uptime.Days.ToString() + "d " + $Uptime.Hours.ToString() + "h " + $Uptime.Minutes.ToString() + "m " + $Uptime.Seconds.ToString() + "s ";
71+
return $FormattedUptime;
72+
}
73+
74+
75+
Function Get-Shell()
76+
{
77+
return "PowerShell $($PSVersionTable.PSVersion.ToString())";
78+
79+
}
80+
81+
82+
83+
Function Get-RAM()
84+
{
85+
$FreeRam = ([math]::Truncate((Get-CimInstance Win32_OperatingSystem).FreePhysicalMemory / 1KB));
86+
$TotalRam = ([math]::Truncate((Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory / 1MB));
87+
$UsedRam = $TotalRam - $FreeRam;
88+
$FreeRamPercent = ($FreeRam / $TotalRam) * 100;
89+
$FreeRamPercent = "{0:N0}" -f $FreeRamPercent;
90+
$UsedRamPercent = ($UsedRam / $TotalRam) * 100;
91+
$UsedRamPercent = "{0:N0}" -f $UsedRamPercent;
92+
93+
return $UsedRam.ToString() + "MB / " + $TotalRam.ToString() + " MB " + "(" + $UsedRamPercent.ToString() + "%" + ")";
94+
}

wFetch install.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Import-Module .\wfetch.psd1

wFetch remove.ps1

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Remove-Module Art
2+
Remove-Module Data
3+
Remove-Module wfetch

wfetch.psd1

2.83 KB
Binary file not shown.

wfetch.psm1

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

0 commit comments

Comments
 (0)