Skip to content
ConsoleMonster

Basic setup wizard

Edit a folder and component choice, then step through an installation preview.

Demos Wizards

Use it when you need a small editable wizard before connecting installation actions.

  • Live
  • 88×40
  • PowerShell 7.4+
  • .NET 8.0+
Basic setup wizard 88×4024-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.

PowerShellsetup-basic.ps1View on GitHub
# Build a three-step installer preview with editable fields and buttons.
[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.
$installFolder = './toolbox-agent'
$components = @('Core', 'Core + reports')
$wizard = [pscustomobject] @{ Page = $Step }
# Layout: construct the widgets shown on screen.
Show-ConsoleApp {
    New-ConsoleRows -Gap 1 {
        '[bold]Install Toolbox Agent[/] [muted]· Toolbox Agent[/]'
        New-ConsoleTextInput -Name Folder -Label 'Install folder' -Value $installFolder
        New-ConsoleSelect -Name Component -Label Component -Choices $components -Value Core
        New-ConsoleButton -Name Back -Label Back -OnClick { $wizard.Page = [Math]::Max(0, $wizard.Page - 1) }
        New-ConsoleButton -Name Next -Label 'Next / preview' -OnClick { $wizard.Page = [Math]::Min(2, $wizard.Page + 1) }
        # Live updates: rebuild this section when an input or button changes state.
        New-ConsoleBinding {
            param($State)
            New-ConsolePanel -Title (@('1 / 3 · Location', '2 / 3 · Components', '3 / 3 · Review')[$wizard.Page]) {
                switch ($wizard.Page) {
                    0 { 'Choose a writable folder for the agent.' }
                    1 { 'Core runs local jobs. Reports adds an HTML summary.' }
                    2 {
                        # Plain text widgets escape user-entered values automatically.
                        New-ConsoleText "Folder: $($State.Folder)"
                        New-ConsoleText "Component: $($State.Component)"
                        '[pass]Ready to install. Review the folder and components.[/]'
                    }
                }
            }
        }
    }
} @AppOptions
C#Program.csView on GitHub
// Build a three-step installer preview with editable fields and buttons.
// 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 installFolder = "./toolbox-agent";
string[] components = { "Core", "Core + reports" };

// 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.
int page = step;
TextInput folder = new TextInput("Folder", installFolder) { Label = "Install folder" };
Select component = new Select("Component", components.Select(name => new Choice(name))) {
    Label = "Component", Value = "Core"
};
Button back = new Button("Back", "Back");
Button next = new Button("Next", "Next / preview");
back.Clicked += (_, _) => page = Math.Max(0, page - 1);
next.Clicked += (_, _) => page = Math.Min(2, page + 1);
Rows layout = new Rows(new TextBlock("[bold]Install Toolbox Agent[/] [muted]· Toolbox Agent[/]"),
    folder, component, back, next, new AppBinding(state => {
        string title = new[] { "1 / 3 · Location", "2 / 3 · Components", "3 / 3 · Review" }[page];
        IWidget content = page == 0 ? new TextBlock("Choose a writable folder for the agent.")
            : page == 1 ? new TextBlock("Core runs local jobs. Reports adds an HTML summary.")
            : new Rows(new TextBlock("Folder: " + ConsoleMonster.Text.Markup.Escape(state.Get<string>("Folder", ""))),
                new TextBlock("Component: " + ConsoleMonster.Text.Markup.Escape(state.Get<string>("Component", ""))),
                new TextBlock("[pass]Ready to install. Review the folder and components.[/]"));
        return new Panel(content, title);
    })) { 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 setup-basic.ps1.

  3. Run it

    From the folder you saved it in.

    ./setup-basic.ps1
  1. Create a project

    A plain console app; .NET 8 or later.

    dotnet new console -n Setupbasic; cd Setupbasic
  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 setup-basic
Get-ConsoleDemo setup-basic -Path ./setup-basic.ps1
dotnet new install ConsoleMonster.Templates
dotnet new consolemonster --demo setup-basic -n Setupbasic

Make it yours

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

  1. Replace the relative install folder with your application default.

  2. Define your component choices and review text.

  3. Connect a separate explicit install action after validation.

More wizards

All demos