Update write-big.ps1

This commit is contained in:
Markus Fleschutz 2024-03-23 10:18:56 +01:00
parent 2df84055fc
commit 34de8863f4

View File

@ -4,21 +4,25 @@
.DESCRIPTION .DESCRIPTION
This PowerShell script writes the given text in big letters. This PowerShell script writes the given text in big letters.
.PARAMETER text .PARAMETER text
Specifies the text to write Specifies the text to write ("Hello World" by default)
.EXAMPLE .EXAMPLE
PS> ./write-big "Hello World" PS> ./write-big.ps1
_ _ ____ _ _ ___ __ __ ___ ____ _ ____
| |_| || ___)| | | | / _ \ \ \/\/ / / _ \ | _ \| | | _ \
| _ || __) | |__ | |__ ( (_) ) \ / ( (_) )| /| |__ | (_) )
|_| |_||____)|____)|____) \___/ \_/\_/ \___/ |_|\_)|____)|____/
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
param([string]$text = "") param([string]$text = "Hello World")
Set-StrictMode -Version Latest Set-StrictMode -Version Latest
function BigA { param([int]$Row) function BigA { param([int]$row)
switch($Row) { switch($row) {
1 { return " __ " } 1 { return " __ " }
2 { return " /__\ " } 2 { return " /__\ " }
3 { return " /(__)\ " } 3 { return " /(__)\ " }
@ -26,8 +30,8 @@ function BigA { param([int]$Row)
} }
} }
function BigB { param([int]$Row) function BigB { param([int]$row)
switch($Row) { switch($row) {
1 { return " ____ " } 1 { return " ____ " }
2 { return "| _ )" } 2 { return "| _ )" }
3 { return "| _ ( " } 3 { return "| _ ( " }
@ -35,8 +39,8 @@ function BigB { param([int]$Row)
} }
} }
function BigC { param([int]$Row) function BigC { param([int]$row)
switch($Row) { switch($row) {
1 { return " ___ " } 1 { return " ___ " }
2 { return " / __)" } 2 { return " / __)" }
3 { return "( (__ " } 3 { return "( (__ " }
@ -44,8 +48,8 @@ function BigC { param([int]$Row)
} }
} }
function BigD { param([int]$Row) function BigD { param([int]$row)
switch($Row) { switch($row) {
1 { return " ____ " } 1 { return " ____ " }
2 { return "| _ \ " } 2 { return "| _ \ " }
3 { return "| (_) )" } 3 { return "| (_) )" }
@ -53,8 +57,8 @@ function BigD { param([int]$Row)
} }
} }
function BigE { param([int]$Row) function BigE { param([int]$row)
switch($Row) { switch($row) {
1 { return " ____ " } 1 { return " ____ " }
2 { return "| ___)" } 2 { return "| ___)" }
3 { return "| __) " } 3 { return "| __) " }
@ -62,8 +66,8 @@ function BigE { param([int]$Row)
} }
} }
function BigF { param([int]$Row) function BigF { param([int]$row)
switch($Row) { switch($row) {
1 { return " ____ " } 1 { return " ____ " }
2 { return "| ___)" } 2 { return "| ___)" }
3 { return "| __) " } 3 { return "| __) " }
@ -71,8 +75,8 @@ function BigF { param([int]$Row)
} }
} }
function BigG { param([int]$Row) function BigG { param([int]$row)
switch($Row) { switch($row) {
1 { return " ____ " } 1 { return " ____ " }
2 { return " / ___)" } 2 { return " / ___)" }
3 { return "( (__-." } 3 { return "( (__-." }
@ -80,8 +84,8 @@ function BigG { param([int]$Row)
} }
} }
function BigH { param([int]$Row) function BigH { param([int]$row)
switch($Row) { switch($row) {
1 { return " _ _ " } 1 { return " _ _ " }
2 { return "| |_| |" } 2 { return "| |_| |" }
3 { return "| _ |" } 3 { return "| _ |" }
@ -89,8 +93,8 @@ function BigH { param([int]$Row)
} }
} }
function BigI { param([int]$Row) function BigI { param([int]$row)
switch($Row) { switch($row) {
1 { return " _ " } 1 { return " _ " }
2 { return "| |" } 2 { return "| |" }
3 { return "| |" } 3 { return "| |" }
@ -98,8 +102,8 @@ function BigI { param([int]$Row)
} }
} }
function BigJ { param([int]$Row) function BigJ { param([int]$row)
switch($Row) { switch($row) {
1 { return " __ " } 1 { return " __ " }
2 { return " ( |" } 2 { return " ( |" }
3 { return ".-_) |" } 3 { return ".-_) |" }
@ -107,8 +111,8 @@ function BigJ { param([int]$Row)
} }
} }
function BigK { param([int]$Row) function BigK { param([int]$row)
switch($Row) { switch($row) {
1 { return " _ _ " } 1 { return " _ _ " }
2 { return "| |/ )" } 2 { return "| |/ )" }
3 { return "| ( " } 3 { return "| ( " }
@ -116,8 +120,8 @@ function BigK { param([int]$Row)
} }
} }
function BigL { param([int]$Row) function BigL { param([int]$row)
switch($Row) { switch($row) {
1 { return " _ " } 1 { return " _ " }
2 { return "| | " } 2 { return "| | " }
3 { return "| |__ " } 3 { return "| |__ " }
@ -125,8 +129,8 @@ function BigL { param([int]$Row)
} }
} }
function BigM { param([int]$Row) function BigM { param([int]$row)
switch($Row) { switch($row) {
1 { return " _ _ " } 1 { return " _ _ " }
2 { return "| \ / |" } 2 { return "| \ / |" }
3 { return "| \/ |" } 3 { return "| \/ |" }
@ -134,8 +138,8 @@ function BigM { param([int]$Row)
} }
} }
function BigN { param([int]$Row) function BigN { param([int]$row)
switch($Row) { switch($row) {
1 { return " _ _ " } 1 { return " _ _ " }
2 { return "| \ | |" } 2 { return "| \ | |" }
3 { return "| \| |" } 3 { return "| \| |" }
@ -143,8 +147,8 @@ function BigN { param([int]$Row)
} }
} }
function BigO { param([int]$Row) function BigO { param([int]$row)
switch($Row) { switch($row) {
1 { return " ___ " } 1 { return " ___ " }
2 { return " / _ \ " } 2 { return " / _ \ " }
3 { return "( (_) )" } 3 { return "( (_) )" }
@ -152,8 +156,8 @@ function BigO { param([int]$Row)
} }
} }
function BigP { param([int]$Row) function BigP { param([int]$row)
switch($Row) { switch($row) {
1 { return " ____ " } 1 { return " ____ " }
2 { return "| _ \" } 2 { return "| _ \" }
3 { return "| __/" } 3 { return "| __/" }
@ -161,8 +165,8 @@ function BigP { param([int]$Row)
} }
} }
function BigQ { param([int]$Row) function BigQ { param([int]$row)
switch($Row) { switch($row) {
1 { return " ____ " } 1 { return " ____ " }
2 { return " / _ \ " } 2 { return " / _ \ " }
3 { return "( (_) ( " } 3 { return "( (_) ( " }
@ -170,8 +174,8 @@ function BigQ { param([int]$Row)
} }
} }
function BigR { param([int]$Row) function BigR { param([int]$row)
switch($Row) { switch($row) {
1 { return " ____ " } 1 { return " ____ " }
2 { return "| _ \" } 2 { return "| _ \" }
3 { return "| /" } 3 { return "| /" }
@ -179,8 +183,8 @@ function BigR { param([int]$Row)
} }
} }
function BigS { param([int]$Row) function BigS { param([int]$row)
switch($Row) { switch($row) {
1 { return " ____ " } 1 { return " ____ " }
2 { return "/ __)" } 2 { return "/ __)" }
3 { return "\__ \" } 3 { return "\__ \" }
@ -188,8 +192,8 @@ function BigS { param([int]$Row)
} }
} }
function BigT { param([int]$Row) function BigT { param([int]$row)
switch($Row) { switch($row) {
1 { return " _____ " } 1 { return " _____ " }
2 { return "|_ _|" } 2 { return "|_ _|" }
3 { return " | | " } 3 { return " | | " }
@ -197,8 +201,8 @@ function BigT { param([int]$Row)
} }
} }
function BigU { param([int]$Row) function BigU { param([int]$row)
switch($Row) { switch($row) {
1 { return " _ _ " } 1 { return " _ _ " }
2 { return "| | | |" } 2 { return "| | | |" }
3 { return "| |_| |" } 3 { return "| |_| |" }
@ -206,8 +210,8 @@ function BigU { param([int]$Row)
} }
} }
function BigV { param([int]$Row) function BigV { param([int]$row)
switch($Row) { switch($row) {
1 { return " _ _ " } 1 { return " _ _ " }
2 { return "( \/ )" } 2 { return "( \/ )" }
3 { return " \ / " } 3 { return " \ / " }
@ -215,8 +219,8 @@ function BigV { param([int]$Row)
} }
} }
function BigW { param([int]$Row) function BigW { param([int]$row)
switch($Row) { switch($row) {
1 { return " __ __ " } 1 { return " __ __ " }
2 { return "\ \/\/ /" } 2 { return "\ \/\/ /" }
3 { return " \ / " } 3 { return " \ / " }
@ -224,8 +228,8 @@ function BigW { param([int]$Row)
} }
} }
function BigX { param([int]$Row) function BigX { param([int]$row)
switch($Row) { switch($row) {
1 { return " _ _ " } 1 { return " _ _ " }
2 { return "( \/ )" } 2 { return "( \/ )" }
3 { return " ) ( " } 3 { return " ) ( " }
@ -233,8 +237,8 @@ function BigX { param([int]$Row)
} }
} }
function BigY { param([int]$Row) function BigY { param([int]$row)
switch($Row) { switch($row) {
1 { return " _ _ " } 1 { return " _ _ " }
2 { return "( \/ )" } 2 { return "( \/ )" }
3 { return " \ / " } 3 { return " \ / " }
@ -242,8 +246,8 @@ function BigY { param([int]$Row)
} }
} }
function BigZ { param([int]$Row) function BigZ { param([int]$row)
switch($Row) { switch($row) {
1 { return " ____ " } 1 { return " ____ " }
2 { return "(_ )" } 2 { return "(_ )" }
3 { return " / /_ " } 3 { return " / /_ " }
@ -251,8 +255,8 @@ function BigZ { param([int]$Row)
} }
} }
function Big0 { param([int]$Row) function Big0 { param([int]$row)
switch($Row) { switch($row) {
1 { return " ___ " } 1 { return " ___ " }
2 { return " / _ \ " } 2 { return " / _ \ " }
3 { return "( (_) )" } 3 { return "( (_) )" }
@ -260,8 +264,8 @@ function Big0 { param([int]$Row)
} }
} }
function Big1 { param([int]$Row) function Big1 { param([int]$row)
switch($Row) { switch($row) {
1 { return " ___ " } 1 { return " ___ " }
2 { return "/_ |" } 2 { return "/_ |" }
3 { return " | |" } 3 { return " | |" }
@ -269,8 +273,8 @@ function Big1 { param([int]$Row)
} }
} }
function Big2 { param([int]$Row) function Big2 { param([int]$row)
switch($Row) { switch($row) {
1 { return " ___ " } 1 { return " ___ " }
2 { return "(__ \ " } 2 { return "(__ \ " }
3 { return " / _/ " } 3 { return " / _/ " }
@ -278,8 +282,8 @@ function Big2 { param([int]$Row)
} }
} }
function Big3 { param([int]$Row) function Big3 { param([int]$row)
switch($Row) { switch($row) {
1 { return " ___ " } 1 { return " ___ " }
2 { return "(__ )" } 2 { return "(__ )" }
3 { return " (_ \" } 3 { return " (_ \" }
@ -287,8 +291,8 @@ function Big3 { param([int]$Row)
} }
} }
function Big4 { param([int]$Row) function Big4 { param([int]$row)
switch($Row) { switch($row) {
1 { return " __ " } 1 { return " __ " }
2 { return " /. | " } 2 { return " /. | " }
3 { return "(_ _)" } 3 { return "(_ _)" }
@ -296,8 +300,8 @@ function Big4 { param([int]$Row)
} }
} }
function Big5 { param([int]$Row) function Big5 { param([int]$row)
switch($Row) { switch($row) {
1 { return " ____ " } 1 { return " ____ " }
2 { return "| ___)" } 2 { return "| ___)" }
3 { return "|__ \ " } 3 { return "|__ \ " }
@ -305,8 +309,8 @@ function Big5 { param([int]$Row)
} }
} }
function Big6 { param([int]$Row) function Big6 { param([int]$row)
switch($Row) { switch($row) {
1 { return " _ " } 1 { return " _ " }
2 { return " / ) " } 2 { return " / ) " }
3 { return "/ _ \" } 3 { return "/ _ \" }
@ -314,8 +318,8 @@ function Big6 { param([int]$Row)
} }
} }
function Big7 { param([int]$Row) function Big7 { param([int]$row)
switch($Row) { switch($row) {
1 { return " ___ " } 1 { return " ___ " }
2 { return "(__ )" } 2 { return "(__ )" }
3 { return " / / " } 3 { return " / / " }
@ -323,8 +327,8 @@ function Big7 { param([int]$Row)
} }
} }
function Big8 { param([int]$Row) function Big8 { param([int]$row)
switch($Row) { switch($row) {
1 { return " ___ " } 1 { return " ___ " }
2 { return "( _ )" } 2 { return "( _ )" }
3 { return "/ _ \" } 3 { return "/ _ \" }
@ -332,8 +336,8 @@ function Big8 { param([int]$Row)
} }
} }
function Big9 { param([int]$Row) function Big9 { param([int]$row)
switch($Row) { switch($row) {
1 { return " ___ " } 1 { return " ___ " }
2 { return "/ _ \" } 2 { return "/ _ \" }
3 { return "\_ /" } 3 { return "\_ /" }
@ -341,8 +345,8 @@ function Big9 { param([int]$Row)
} }
} }
function BigColon { param([int]$Row) function BigColon { param([int]$row)
switch($Row) { switch($row) {
1 { return " " } 1 { return " " }
2 { return " o " } 2 { return " o " }
3 { return " o " } 3 { return " o " }
@ -350,8 +354,8 @@ function BigColon { param([int]$Row)
} }
} }
function BigMinus { param([int]$Row) function BigMinus { param([int]$row)
switch($Row) { switch($row) {
1 { return " " } 1 { return " " }
2 { return " ____ " } 2 { return " ____ " }
3 { return "(____)" } 3 { return "(____)" }
@ -359,63 +363,61 @@ function BigMinus { param([int]$Row)
} }
} }
function BigChar { param([string]$Char, [int]$Row) function BigChar { param([string]$char, [int]$row)
switch($Char) { switch($char) {
'A' { return BigA $Row } 'A' { return BigA $row }
'B' { return BigB $Row } 'B' { return BigB $row }
'C' { return BigC $Row } 'C' { return BigC $row }
'D' { return BigD $Row } 'D' { return BigD $row }
'E' { return BigE $Row } 'E' { return BigE $row }
'F' { return BigF $Row } 'F' { return BigF $row }
'G' { return BigG $Row } 'G' { return BigG $row }
'H' { return BigH $Row } 'H' { return BigH $row }
'I' { return BigI $Row } 'I' { return BigI $row }
'J' { return BigJ $Row } 'J' { return BigJ $row }
'K' { return BigK $Row } 'K' { return BigK $row }
'L' { return BigL $Row } 'L' { return BigL $row }
'M' { return BigM $Row } 'M' { return BigM $row }
'N' { return BigN $Row } 'N' { return BigN $row }
'O' { return BigO $Row } 'O' { return BigO $row }
'P' { return BigP $Row } 'P' { return BigP $row }
'Q' { return BigQ $Row } 'Q' { return BigQ $row }
'R' { return BigR $Row } 'R' { return BigR $row }
'S' { return BigS $Row } 'S' { return BigS $row }
'T' { return BigT $Row } 'T' { return BigT $row }
'U' { return BigU $Row } 'U' { return BigU $row }
'V' { return BigV $Row } 'V' { return BigV $row }
'W' { return BigW $Row } 'W' { return BigW $row }
'X' { return BigX $Row } 'X' { return BigX $row }
'Y' { return BigY $Row } 'Y' { return BigY $row }
'Z' { return BigZ $Row } 'Z' { return BigZ $row }
'0' { return Big0 $Row } '0' { return Big0 $row }
'1' { return Big1 $Row } '1' { return Big1 $row }
'2' { return Big2 $Row } '2' { return Big2 $row }
'3' { return Big3 $Row } '3' { return Big3 $row }
'4' { return Big4 $Row } '4' { return Big4 $row }
'5' { return Big5 $Row } '5' { return Big5 $row }
'6' { return Big6 $Row } '6' { return Big6 $row }
'7' { return Big7 $Row } '7' { return Big7 $row }
'8' { return Big8 $Row } '8' { return Big8 $row }
'9' { return Big9 $Row } '9' { return Big9 $row }
':' { return BigColon $Row } ':' { return BigColon $row }
'-' { return BigMinus $Row } '-' { return BigMinus $row }
} }
return " " return " "
} }
try { try {
if ($text -eq "" ) { [String]$text = read-host "Enter text to write" } Write-Output ""
[char[]]$arrayOfChars = $text.ToUpper()
[char[]]$ArrayOfChars = $text.ToUpper() for ($row = 1; $row -lt 5; $row++) {
write-output "" $line = ""
for ($Row = 1; $Row -lt 5; $Row++) { foreach($char in $arrayOfChars) {
$Line = "" $line += BigChar $char $row
foreach($Char in $ArrayOfChars) {
$Line += BigChar $Char $Row
} }
write-output $Line Write-Output $line
} }
write-output "" Write-Output ""
exit 0 # success exit 0 # success
} catch { } catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"