Skip to content

Commit

Permalink
Create StringBuilderParams.Ninsense.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
ninmonkey committed Dec 25, 2023
1 parent 6f34ef3 commit 7fea0cb
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Pwsh/Formatting/StringBuilder/StringBuilderParams.Ninsense.ps1
Original file line number Diff line number Diff line change
@@ -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(
}

0 comments on commit 7fea0cb

Please sign in to comment.