Cmdlet
Use-ConsoleGroup
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 SetsDescription
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
- The work to run inside the group.
- -Title String
- 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.