Skip to content
ConsoleMonster
Cmdlet

New-ConsoleRule

Module
ConsoleMonster
Outputs
ConsoleMonster.Widgets.Rule

Creates a horizontal rule, optionally with a title.

Syntax

New-ConsoleRule
[-Alignment <Left|Center|Right>]
[-LineRole <ThemeToken>]
[-LineStyle <Rounded|Single|Double|Heavy|Ascii>]
[[-Title] <Object>]
[<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

The line uses the border colour and the glyph tier's line character.

Examples

Example 1

New-ConsoleRule -Title 'Results'

A titled separator

Example 2

New-ConsoleRows -Content {
    $ruleOptions = @{
        Title = 'Inventory'
    }
    New-ConsoleRule @ruleOptions
    $textOptions = @{
        Text = @('2 servers checked')
        Role = 'Pass'
    }
    New-ConsoleText @textOptions
} | Show-Console

Compose an inventory rule

Example 3

Get-ConsoleDemo -Slug 'backup-runner' | Select-Object -ExpandProperty Source
Get-ConsoleDemo -Slug 'everyday-formatting' | Select-Object -ExpandProperty Source

Read any of these gallery scripts to see New-ConsoleRule in a complete example. Each lookup returns the script's source. Use the same slug with Show-ConsoleDemo to run it.

Parameters

-Alignment HorizontalAlignment optional
Title alignment: Left, Center or Right.
Possible values: Left, Center, Right
-LineRole ThemeToken optional
Theme role for the line; default Border.
Possible values: Text, Muted, Subtle, Accent, Accent2, Pass, Fail, Warn, Info, Skip, Running, Pending, Border, Title, Header, Highlight, Surface, SurfaceAccent, Series1, Series2, Series3, Series4, Series5, Series6, Focus, Strong, Low, Critical, Gap
-LineStyle BoxStyle optional
Optional line glyph style; omitted follows the active theme.
Possible values: Rounded, Single, Double, Heavy, Ascii
-Title Object optionalposition: 0
The title (markup allowed).

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.