Skip to content

Out-Columns multiline support#713

Merged
bill-long merged 2 commits into
mainfrom
bilong-wrap
Aug 23, 2021
Merged

Out-Columns multiline support#713
bill-long merged 2 commits into
mainfrom
bilong-wrap

Conversation

@bill-long
Copy link
Copy Markdown
Member

Any array property now produces multiline output. This is mostly intended for large amounts of text, but may be useful in other scenarios as well. Example:

$tailSpinToys = [PSCustomObject]@{ Company = "TailSpinToys"; Description = "Short description"; Ids = 12432, 8223 }
$longText = @(
  "Lorem ipsum dolor sit amet,",
  "consectetur adipiscing elit. Ut sodales",
  "ligula dui, dictum pharetra mauris hendrerit",
  "vel. Vivamus odio velit, tempus eget",
  "sit amet, fermentum laoreet.")
$contoso = [PSCustomObject]@{ Company = "Contoso"; Description = $longText; Ids = 3458 }
$aDatum = [PSCustomObject]@{ Company = "A. Datum Corp"; Description = "Another short description"; Ids = 1923823 }
$companies = $tailSpinToys, $contoso, $aDatum
$companies | Out-Columns -ColorizerFunctions @({ param($o, $p) if ($o."$p" -like "*ipsum*") { "Red" } })

Result:

image

@bill-long bill-long merged commit 4589058 into main Aug 23, 2021
@bill-long bill-long deleted the bilong-wrap branch August 23, 2021 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants