Skip to content
ConsoleMonster
Cmdlet

New-ConsoleSummaryBar

Module
ConsoleMonster
Outputs
ConsoleMonster.Widgets.SummaryBar

Creates a summary bar: one line with progress, done of total, the time left and result counters.

Syntax

New-ConsoleSummaryBar
[-BarWidth <Int32>]
[-Counter <IDictionary>]
[-DoneLabel <String>]
[-ElapsedSeconds <Double>]
[-NoElapsed]
[[-Total] <Double>]
[[-Value] <Double>]
[[-WidgetId] <String>]
[<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

The line Invoke-ConsoleRun ends its view with, as a widget of its own: a thin bar, done of total, the percentage, the time left (estimated from -ElapsedSeconds and the share done) and counters in a fixed order with zeros dimmed rather than hidden. -Counter maps labels to counts; a label that is a status word (passed, failed, warnings, skipped, running) takes that status's symbol and colour. Without -Total only the count done shows.

Examples

Example 1

$summaryBarOptions = @{
    Value = 30
    Total = 40
    ElapsedSeconds = 42
    Counter = ([ordered] @{ passed = 27; failed = 2; skipped = 1 })
}
New-ConsoleSummaryBar @summaryBarOptions | Show-Console

A run three quarters through

Example 2

$summaryBarOptions = @{
    Total = 12
    Value = 9
    Counter = ([ordered]@{ passed = 8; warnings = 1 })
}
New-ConsoleSummaryBar @summaryBarOptions | Show-Console

Summarize completed inventory checks

Example 3

Get-ConsoleDemo -Slug 'parallel-patch' | Select-Object -ExpandProperty Source
Get-ConsoleDemo -Slug 'toolbox' | Select-Object -ExpandProperty Source

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

Parameters

-BarWidth Int32 optional
The bar width in cells (default 20; narrow space shrinks it).
-Counter IDictionary optional
Labels mapped to counts, in the order to show them; status words (passed, failed, skipped...) take their status symbol and colour.
-DoneLabel String optional
Custom completed-count label; omitted uses the localized default.
-ElapsedSeconds Double optional
Elapsed seconds used to estimate remaining time. Fractional seconds are accepted.
-NoElapsed SwitchParameter optional
Hides the elapsed and remaining duration.
-Total Double optionalposition: 2
Items in total (0 = unknown: no bar, percentage or time left).
-Value Double optionalposition: 1
Initial number of completed items, displayed relative to Total.
-WidgetId String optionalposition: 0
The live name (default summary).

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.