Skip to content
ConsoleMonster

Task menu

Choose a task and inspect a safe preview before connecting your own actions.

Demos Terminal apps

Use it when a handful of admin operations need a discoverable menu and preview.

  • Live
  • 88×22
  • PowerShell 7.4+
  • .NET 8.0+
Task menu 88×2224-bitFull

How it's built

The whole program in one file, with its sample data at the top. It drew the recording above; both languages draw the same cells.

PowerShelltask-menu.ps1View on GitHub
# Select a server task and show its read-only preview.
[CmdletBinding()]
param(
    [switch] $StaticSnapshot,
    [ValidateRange(0, 2)] [int] $Step = 0,
    [hashtable] $AppOptions = @{}
)

Import-Module ConsoleMonster
# All data is synthetic and inline; no services are contacted or changed.
$AppOptions.StaticSnapshot = $StaticSnapshot -or ([Console]::IsInputRedirected -and -not $AppOptions.InputSource)

# Data: fictional inputs kept in memory.
$tasks = @('Health report', 'Inspect queue', 'Preview cleanup')
$selected = $tasks[$Step]
# Layout: construct the widgets shown on screen.
Show-ConsoleApp {
    New-ConsoleRows -Gap 1 {
        '[bold]Server toolbox[/] [muted]· operations[/]'
        New-ConsoleSelect -Name Task -Label Task -Choices $tasks -Value $selected
        # Live updates: rebuild this section when an input or button changes state.
        New-ConsoleBinding {
            param($State)
            New-ConsolePanel -Title Preview {
                switch ([string] $State.Task) {
                    'Health report' { '[pass]web-01 reachable[/]'; 'CPU 24% · memory 61%' }
                    'Inspect queue' { '[accent]12 jobs waiting[/]'; 'Oldest job 4 minutes' }
                    'Preview cleanup' { '[warn]3 artifacts eligible[/]'; 'Eligible artifacts: build-cache, test-output, old-logs.' }
                }
            }
        }
    }
} @AppOptions
C#Program.csView on GitHub
// Select a server task and show its read-only preview.
// All data is synthetic and inline; no services are contacted or changed.
using ConsoleMonster.Interactive;
using ConsoleMonster.Layout;
using ConsoleMonster.Widgets;

// Data: fictional inputs kept in memory.
string[] tasks = { "Health report", "Inspect queue", "Preview cleanup" };
// Run options: redirected input selects a deterministic snapshot.
bool snapshot = args.Contains("--snapshot") || (!args.Contains("--interactive") && Console.IsInputRedirected);
int stepAt = Array.IndexOf(args, "--step");
int step = stepAt < 0 ? 0 : int.Parse(args[stepAt + 1], System.Globalization.CultureInfo.InvariantCulture);
if (step < 0 || step > 2) throw new ArgumentOutOfRangeException(nameof(step));

// Layout: construct the widgets shown on screen.
Rows layout = new Rows(new TextBlock("[bold]Server toolbox[/] [muted]· operations[/]"),
    new Select("Task", tasks.Select(task => new Choice(task))) { Label = "Task", Value = tasks[step] },
    new AppBinding(state => {
        string task = state.Get<string>("Task", tasks[0]);
        string[] lines = task == tasks[0] ? new[] { "[pass]web-01 reachable[/]", "CPU 24% · memory 61%" }
            : task == tasks[1] ? new[] { "[accent]12 jobs waiting[/]", "Oldest job 4 minutes" }
            : new[] { "[warn]3 artifacts eligible[/]", "Eligible artifacts: build-cache, test-output, old-logs." };
        return new Panel(new Rows(lines.Select(line => new TextBlock(line)).ToArray()), "Preview");
    })) { Gap = 1 };
// Live updates: ConsoleApp handles input and reevaluates AppBinding as state changes.
// Escape exits; snapshot mode prints the selected state without reading keys.
ConsoleApp.Run(layout, options: new ConsoleAppOptions { StaticSnapshot = snapshot });

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 task-menu.ps1.

  3. Run it

    From the folder you saved it in.

    ./task-menu.ps1
  1. Create a project

    A plain console app; .NET 8 or later.

    dotnet new console -n Taskmenu; cd Taskmenu
  2. Add ConsoleMonster

    The only package the program needs.

    dotnet add package ConsoleMonster
  3. Replace Program.cs

    Download it, or copy the program from above.

  4. Run it

    dotnet run

Or skip the copying. Every demo ships with the module and the project template.

Show-ConsoleDemo task-menu
Get-ConsoleDemo task-menu -Path ./task-menu.ps1
dotnet new install ConsoleMonster.Templates
dotnet new consolemonster --demo task-menu -n Taskmenu

Make it yours

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

  1. Replace the three task labels with your operations.

  2. Use a read-only query for each preview.

  3. Add explicit confirmation before a destructive action.

More terminal apps

All demos