Skip to content

Latest commit

 

History

History
37 lines (29 loc) · 2.56 KB

File metadata and controls

37 lines (29 loc) · 2.56 KB

← Back to Backlog

[SC-003] ✅ DONE - Stop action functions from reprinting distro table in interactive mode

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:

  1. Main menu shows: 1. Debian (Stopped) / 2. Ubuntu (Running) / 3. Fedora (Running)
  2. User selects [T] Terminate
  3. Terminate shows: 1. Ubuntu (Running) / 2. Fedora (Running) — Debian gone, numbering shifted
  4. User remembers Fedora as 3 from the main menu, but now it's 2

Scope decisions:

  • Invoke-WslManager fetches the distro list once and passes it to all action functions via a mandatory -Distros parameter — applies to both CLI and interactive mode
  • In interactive mode: Start-InteractiveMode displays the table; action functions skip reprinting it; numbering stays consistent
  • In CLI mode: action functions receive the list from Invoke-WslManager but may still print it if needed for standalone context
  • Invoke-TerminateDistro uses 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 -Detailed calls from action functions (only Invoke-WslManager fetches)

Acceptance Criteria:

  • Action functions do not reprint the distro table when invoked from interactive mode
  • Numbering stays consistent with the main menu table
  • Invoke-TerminateDistro handles 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

← Back to Backlog