feat: support both comma and space separated selection

This commit is contained in:
Windneiro 2026-04-14 09:37:26 +05:00
parent bb2b87f132
commit 3e8877fb80
1 changed files with 5 additions and 3 deletions

View File

@ -1,4 +1,4 @@
# ============================================================
# ============================================================
# Skript ustanovki programm
# Zapusk: irm https://git.help-d.ru/helmut/auto-turning/raw/branch/main/setup.ps1 | iex
# ============================================================
@ -94,7 +94,7 @@ foreach ($prog in $programList) {
Write-Host "`n a - ALL programs" -ForegroundColor Green
Write-Host " 0 - Cancel`n" -ForegroundColor Gray
$choice = Read-Host "Select (numbers separated by space, or a)"
$choice = Read-Host "Select (1 2 3 or 1,2,3 or a)"
if ($choice -eq "0") {
Write-Host "Canceled" -ForegroundColor Red
@ -105,7 +105,9 @@ $selectedPrograms = @()
if ($choice -eq "a") {
$selectedPrograms = $allPrograms
} else {
foreach ($num in ($choice -split '\s+') | Where-Object { $_ -match '^\d+$' }) {
# Поддержка: "1, 2, 3" или "1 2 3" или "1,2,3"
$normalized = $choice -replace ',', ' '
foreach ($num in ($normalized -split '\s+') | Where-Object { $_ -match '^\d+$' }) {
if ($progMap[[int]$num]) {
$selectedPrograms += $progMap[[int]$num]
}