-
-
Notifications
You must be signed in to change notification settings - Fork 546
Expand file tree
/
Copy pathbrew-coffee.ps1
More file actions
executable file
·68 lines (57 loc) · 1.47 KB
/
brew-coffee.ps1
File metadata and controls
executable file
·68 lines (57 loc) · 1.47 KB
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
<#
.SYNOPSIS
Brews coffee as animation
.DESCRIPTION
This PowerShell script writes a coffee cup with animated steam to the console.
.EXAMPLE
PS> ./brew-coffee.ps1
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
#requires -version 5.1
function Start-CoffeeCupAnimation { param ([int]$DelayMs = 250)
$SteamFrames = @(
# Frame 1
@( " "
" "
" )( )( "
" ( ) ( ) "
" )( )( "
),
# Frame 2
@(
" "
" "
" ( ) ( ) "
" )( )( "
" ( ) ( ) "
)
)
$SteamFrameIndex = 0
$CoffeeCup = @(
" _________ "
" ###| | "
" | | | "
" | | B O S S | "
" | | | "
" ###|_________| "
" \_________/ "
)
while ($true) {
$currentSteam = $SteamFrames[$SteamFrameIndex]
Clear-Host
foreach ($line in $currentSteam) { Write-Host $line }
foreach ($line in $CoffeeCup) { Write-Host $line }
$SteamFrameIndex = ($SteamFrameIndex + 1) % $SteamFrames.Length
Start-Sleep -Milliseconds $DelayMs
}
}
try {
Start-CoffeeCupAnimation
exit 0 # success
} catch {
"⚠️ Error: $($Error[0])"
exit 1
}