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