From 7fea0cb75aaeef086450aa1ff2a56ac50585d2d1 Mon Sep 17 00:00:00 2001 From: Jake Bolton Date: Mon, 25 Dec 2023 09:22:33 -0600 Subject: [PATCH] Create StringBuilderParams.Ninsense.ps1 --- .../StringBuilderParams.Ninsense.ps1 | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Pwsh/Formatting/StringBuilder/StringBuilderParams.Ninsense.ps1 diff --git a/Pwsh/Formatting/StringBuilder/StringBuilderParams.Ninsense.ps1 b/Pwsh/Formatting/StringBuilder/StringBuilderParams.Ninsense.ps1 new file mode 100644 index 0000000..89ecf04 --- /dev/null +++ b/Pwsh/Formatting/StringBuilder/StringBuilderParams.Ninsense.ps1 @@ -0,0 +1,31 @@ +Import-Module NameIt -ea 'stop' + +'Weird stuff with String builders' | write-host -fg '#745074' -bg '#555759' +'Weird stuff with String builders' | write-host -fg '#745074' -bg '#7aa1b9' +'Weird stuff with String builders' | write-host -fg '#745074' -bg '#2e3440' +# SillyStringBuilderParams + +function AsBuilder { + param( [Text.StringBuilder]$InText ) + $name = Get-Process | % Name | Get-Random + [void]$InText.AppendLine( $Name ) + [void]$inText.Append( ( $strId++ )) + + return $InText + # return $inText.ToString() +} + +function SB.Append { + # you can pass regular strings to string builder parameters + param( + [Parameter(Mandatory)] + [Alias('Str', 'Text', 'InObj', 'String', 'Name', 'ToString')] + [Text.StringBuilder]$InSb, + + [Alias('Str', 'Text', 'InObj', 'String', 'Name', 'ToString')] + [Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)] + [string[]]$InputObject + ) + + # $InText.AppendLine( +}