Skip to content
ConsoleMonster
Cmdlet

New-ConsoleStatusItem

Module ConsoleMonster
Inputs
None
Outputs
ConsoleMonster.Widgets.StatusItem

Creates one status item, a step with a status and a detail, for New-ConsoleStatusList and New-ConsolePhases.

Syntax

New-ConsoleStatusItem [-Detail <Object>] [-Key <String>] [-Label] <Object> [[-Status] <StatusKind>] [<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

Creates one status item, a step with a status and a detail, for New-ConsoleStatusList and New-ConsolePhases.

Use it inside the script block of New-ConsoleStatusList (a checklist) or New-ConsolePhases (a strip of stages). -Status is the shared status vocabulary: Pass, Fail, Warn, Skip, Info, Running or Pending, and PowerShell's words such as Success, Warning and Error. -Detail is a muted note on the right, such as a duration. The label is shown literally; rich text from New-ConsoleText keeps its colours. -Key names the item for live updates (Update-ConsoleStatus, Update-ConsolePhase) when it differs from the label. To add items to a list made earlier, pipe the list to Add-ConsoleItem.

Examples

Authored help example

EXAMPLE 1

New-ConsoleStatusList {
    New-ConsoleStatusItem 'Restore NuGet packages' -Status Pass -Detail '1.6 s'
    New-ConsoleStatusItem 'Run Pester on PowerShell 7' -Status Warn -Detail '1 skipped'
    New-ConsoleStatusItem 'Publish to PowerShell Gallery' -Status Pending
} | Write-ConsoleWidget

A build checklist

EXAMPLE 2

New-ConsolePhases {
    New-ConsoleStatusItem 'Discover' -Status Pass -Detail '2.1s'
    New-ConsoleStatusItem 'Evaluate' -Status Running -Detail '64%'
    New-ConsoleStatusItem 'Report'
} | Write-ConsoleWidget

Phases of a run

Parameters

-Detail Object optional
A muted detail on the right, for example a duration or a count.
-Key String optional
The key for live updates (Update-ConsoleStatus -Key, Update-ConsolePhase -Key); defaults to the label's text.
-Label Object requiredposition: 0
The label (shown literally; rich text from New-ConsoleText keeps its colours).
-Status StatusKind optionalposition: 1
The status (default Pending): Pass, Fail, Warn, Skip, Info, Running or Pending, or PowerShell's words such as Success, Warning and Error.
Possible values: Pending, Running, Pass, Fail, Warn, Skip, Info

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.