Status: Done (2026-03-06)
Priority: Medium
Component: tools/pslib/wsl/wsl-manager.ps1
Depends on: SC-005
Summary: As a WSL manager user, I want the interactive menu to show the distro table only once so that I can select a distribution without being confused by redundant or inconsistently numbered lists.
Description:
In interactive mode, Start-InteractiveMode already displays the numbered distro table via Show-WslDistroList. When the user selects an action (e.g., Update, Remove, Terminate), the action function (Invoke-UpdateDistro, Invoke-RemoveDistro, Invoke-TerminateDistro, Invoke-SetupUserInteractive, Invoke-SetupDockerInteractive, Invoke-SetupPodmanInteractive, Invoke-CloneDistro) re-fetches and reprints its own distro table before prompting for a selection. This is redundant and confusing — especially for Invoke-TerminateDistro, which filters to running distros only, producing different numbering than the main menu table.
Current behavior:
- Main menu shows:
1. Debian (Stopped) / 2. Ubuntu (Running) / 3. Fedora (Running) - User selects
[T] Terminate - Terminate shows:
1. Ubuntu (Running) / 2. Fedora (Running)— Debian gone, numbering shifted - User remembers Fedora as
3from the main menu, but now it's2
Scope decisions:
Invoke-WslManagerfetches the distro list once and passes it to all action functions via a mandatory-Distrosparameter — applies to both CLI and interactive mode- In interactive mode:
Start-InteractiveModedisplays the table; action functions skip reprinting it; numbering stays consistent - In CLI mode: action functions receive the list from
Invoke-WslManagerbut may still print it if needed for standalone context Invoke-TerminateDistrouses the full list with consistent numbering and validates that the selected distro is running (clear error if not, instead of silently filtering)- Removes 7 redundant
Get-WslDistroList -Detailedcalls from action functions (onlyInvoke-WslManagerfetches)
Acceptance Criteria:
- Action functions do not reprint the distro table when invoked from interactive mode
- Numbering stays consistent with the main menu table
-
Invoke-TerminateDistrohandles non-running selection gracefully (error message instead of silent filter) - CLI mode (
wsl-manager <command> <name>) behavior unchanged - Unit tests updated
- All existing tests continue to pass