Skip to content
ConsoleMonster
Cmdlet

Use-ConsoleGroup

Module
ConsoleMonster
Outputs
System.Object

Runs a script inside a collapsible CI log group or beneath a muted terminal heading.

Syntax

Use-ConsoleGroup
[-ScriptBlock] <ScriptBlock>
[-Title] <String>
[<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

Uses GitHub Actions, Azure Pipelines or GitLab CI commands when detected. CONSOLEMONSTER_CI can force github, azure, gitlab or none. Groups nest and close in finally, including when the script throws. The script runs with the caller's variables and returns its output.

Examples

Example 1

Use-ConsoleGroup 'Build' { dotnet build }

Group a build log

Example 2

Use-ConsoleGroup 'Check sample inventory' {
    [pscustomobject]@{ Server = 'web01'; Result = 'Pass' } | Show-ConsoleTable
}

Group a sample inventory in a CI log

Parameters

-ScriptBlock ScriptBlock requiredposition: 1
The work to run inside the group.
-Title String requiredposition: 0
The literal log heading.

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.