Skip to content
ConsoleMonster

Assessment review

Review completed checks in one table and keep the exact check source alongside the failure.

Demos Everyday

Use it when a failed check needs a report and its exact source.

  • Static
  • 88×24
  • PowerShell 7.4+
  • .NET 8.0+
Assessment review 88×2424-bitFull

How it's built

The whole program in one file, with its sample data at the top. It drew the recording above; all three styles produce the same frame bytes.

PowerShellassessment-review.ps1View on GitHub
# A fixture shaped like assessment results. It never contacts the sample hosts.
Import-Module -Name ConsoleMonster
$checks = @(
    [pscustomobject] @{ Check = 'Replication'; Target = 'dc-west-01'; Status = 'Pass'
        Detail = 'All partners responded' }
    [pscustomobject] @{ Check = 'Disk capacity'; Target = 'dc-west-01'; Status = 'Warn'
        Detail = '14% free on the system volume' }
    [pscustomobject] @{ Check = 'Name resolution'; Target = 'dc-east-02'; Status = 'Fail'
        Detail = 'No DNS response before the deadline' }
)
$statusColumn = @{ Name = 'Status'; Expression = 'Status'; Presenter = 'StatusWord' }
$table = $checks |
    New-ConsoleTable -Property Check, Target, $statusColumn, Detail -Expand
$source = @'
# Check fixture
function Test-NameResolution {
    param([string] $Target)
    Resolve-DnsName -Name $Target -ErrorAction Stop
}
'@
$consoleParameters = @{
    View = 'Code'
    FunctionName = 'Test-NameResolution'
    Title = 'Name resolution check'
    Highlight = 4
    AsWidget = $true
}
$excerpt = $source |
    Show-Console @consoleParameters
New-ConsoleRows -Gap 1 -Content {
    New-ConsoleRule -Title '[accent bold]Assessment review[/]'
    $table
    $excerpt
} | Show-Console
C#Program.csView on GitHub
using ConsoleMonster;
using ConsoleMonster.Layout;
using ConsoleMonster.Presenters;
using ConsoleMonster.Widgets;

// A fixture shaped like assessment results. It never contacts the sample hosts.
CheckResult[] checks = new CheckResult[]
{
    new("Replication", "dc-west-01", "Pass", "All partners responded"),
    new("Disk capacity", "dc-west-01", "Warn", "14% free on the system volume"),
    new("Name resolution", "dc-east-02", "Fail", "No DNS response before the deadline")
};
var table = Table.For(checks)
    .Column(check => check.Check)
    .Column(check => check.Target)
    .Column(check => check.Status, column => column.Presenter = CellPresenters.StatusWord)
    .Column(check => check.Detail);
table.Expand = true;

string source = ("# Check fixture\nfunction Test-NameResolution {\n    param([string] $Target)\n    "
    + "Resolve-DnsName -Name $Target -ErrorAction Stop\n}");
var excerpt = CodeView.FromLines(source, 2, 5, "PowerShell");
excerpt.Title = "Name resolution check";
excerpt.HighlightLines(4);
Rows report = new Rows(new Rule("[accent bold]Assessment review[/]"), table, excerpt) { Gap = 1 };
Terminal.Write(report);

record CheckResult(string Check, string Target, string Status, string Detail);
C# fluentProgram.Fluent.csView on GitHub
using ConsoleMonster;
using ConsoleMonster.Layout;
using ConsoleMonster.Presenters;
using ConsoleMonster.Widgets;

// A fixture shaped like assessment results. It never contacts the sample hosts.
CheckResult[] checks = new CheckResult[]
{
    new("Replication", "dc-west-01", "Pass", "All partners responded"),
    new("Disk capacity", "dc-west-01", "Warn", "14% free on the system volume"),
    new("Name resolution", "dc-east-02", "Fail", "No DNS response before the deadline")
};
var table = Ui.Table(checks)
    .Column(check => check.Check)
    .Column(check => check.Target)
    .Column(check => check.Status, column => column.Presenter(CellPresenters.StatusWord))
    .Column(check => check.Detail)
    .Expand();
string source = ("# Check fixture\nfunction Test-NameResolution {\n    param([string] $Target)\n    "
    + "Resolve-DnsName -Name $Target -ErrorAction Stop\n}");
var excerpt = CodeView.FromLines(source, 2, 5, "PowerShell").Title("Name resolution check");
excerpt.HighlightLines(4);
Rows report = Ui.Rows().Gap(1).Content(rowsContent =>
{
    rowsContent.Rule("[accent bold]Assessment review[/]");
    rowsContent.Add(table);
    rowsContent.Add(excerpt);
});
report.Show();

record CheckResult(string Check, string Target, string Status, string Detail);

Run it yourself

Three steps in PowerShell, four in C#. Every command copies with one click.

  1. Install the module

    Once. Windows PowerShell 5.1 or PowerShell 7 on Windows, macOS or Linux.

    Install-Module ConsoleMonster -Scope CurrentUser
  2. Save the program

    Download it, or copy it from above into assessment-review.ps1.

  3. Run it

    From the folder you saved it in.

    ./assessment-review.ps1
  1. Create a project

    A plain console app; .NET 8 or later.

    dotnet new console -n AssessmentReview; cd AssessmentReview
  2. Save the project

    The project selects one C# style at a time and restores ConsoleMonster.

  3. Save both programs

    Replace Program.cs and save Program.Fluent.cs beside it.

  4. Run it

    dotnet run
  1. Create a project

    A plain console app; .NET 8 or later.

    dotnet new console -n AssessmentReview; cd AssessmentReview
  2. Save the project

    The project selects one C# style at a time and restores ConsoleMonster.

  3. Save both programs

    Replace Program.cs and save Program.Fluent.cs beside it.

  4. Run it

    dotnet run --property:DemoStyle=Fluent

Or skip the copying. Run the bundled program.

Show-ConsoleDemo assessment-review
$source = (Get-ConsoleDemo assessment-review).Source
[IO.File]::WriteAllText("$PWD/assessment-review.ps1", $source, [Text.UTF8Encoding]::new($true))

Make it yours

Start with these, then read the rest of the file.

  1. Project results from your assessment into check, target, status, and detail.

  2. Use the same table in a terminal report or as part of an HTML export.

  3. Select the relevant source excerpt and keep its original line numbers.

More everyday

All demos