Skip to content

Format-SpectreColumns

Description

This function creates a spectre columns widget that renders a collection of renderables in autosized columns to the console.
Columns can contain renderable items.
See https://spectreconsole.net/widgets/columns for more information.


Examples

Example 1
This example demonstrates how to display a collection of strings in columns.

Terminal window
@("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit,", "sed", "do", "eiusmod",
"tempor", "incididunt", "ut", "labore", "et", "dolore", "magna", "aliqua.", "Ut", "enim", "ad", "minim",
"veniam,", "quis", "nostrud", "exercitation", "ullamco", "laboris", "nisi", "ut", "aliquip", "ex", "ea",
"commodo", "consequat", "duis", "aute", "irure", "dolor", "in", "reprehenderit", "in", "voluptate", "velit",
"esse", "cillum", "dolore", "eu", "fugiat", "nulla", "pariatur", "excepteur", "sint", "occaecat",
"cupidatat", "non", "proident", "sunt", "in", "culpa") | Foreach-Object { $_ } | Format-SpectreColumns

Example 2
This example demonstrates how to display a collection of panels that are expanded but with normal sized columns.

Terminal window
@("left", "middle", "right") | Foreach-Object { $_ | Format-SpectrePanel -Expand } | Format-SpectreColumns

Example 3
This example demonstrates how to display a collection of panels that are expanded and with expanded columns so it takes up the console width.

Terminal window
@("left", "middle", "right") | Foreach-Object { $_ | Format-SpectrePanel -Expand } | Format-SpectreColumns -Expand

Parameters

Data

An array of objects containing the data to be displayed in the columns.

TypeRequiredPositionPipelineInput
[Object]true1true (ByValue)

Padding

The padding to apply to the columns.

TypeRequiredPositionPipelineInput
[Int32]false2false

Expand

A switch to expand the columns to fill the available space.

TypeRequiredPositionPipelineInput
[Switch]falsenamedfalse

Syntax

Terminal window
Format-SpectreColumns [-Data] <Object> [[-Padding] <Int32>] [-Expand] [<CommonParameters>]