Refactor feature handling, update format in Features.json

This commit is contained in:
Raphire
2026-04-01 21:33:24 +02:00
parent 105198e396
commit c79c05f286
9 changed files with 410 additions and 415 deletions

View File

@@ -11,7 +11,7 @@ function PrintPendingChanges {
}
if ($script:Params['CreateRestorePoint']) {
Write-Output "- $($script:Features['CreateRestorePoint'].Label)"
Write-Output "- $($script:Features['CreateRestorePoint'].Action)"
}
foreach ($parameterName in $script:Params.Keys) {
if ($script:ControlParams -contains $parameterName) {
@@ -65,18 +65,17 @@ function PrintPendingChanges {
}
default {
if ($script:Features -and $script:Features.ContainsKey($parameterName)) {
$action = if ($undoChanges -and $script:Features[$parameterName].UndoAction) {
$message = if ($undoChanges -and $script:Features[$parameterName].UndoAction) {
$script:Features[$parameterName].UndoAction
}
else {
$script:Features[$parameterName].Action
}
$message = $script:Features[$parameterName].Label
if ($action) {
Write-Output "- $action $message"
if ($message) {
Write-Output "- $message"
}
else {
Write-Output "- $message"
Write-Output "- $parameterName"
}
}
else {
@@ -94,9 +93,7 @@ function PrintPendingChanges {
$uniqueSkipped = $skippedParams | Sort-Object -Unique
foreach ($skippedParam in $uniqueSkipped) {
$action = $script:Features[$skippedParam].Action
$message = $script:Features[$skippedParam].Label
Write-Output "- $action $message"
Write-Output "- $($script:Features[$skippedParam].Action)"
}
}
@@ -104,4 +101,4 @@ function PrintPendingChanges {
Write-Output ""
Write-Output "Press enter to execute the script or press CTRL+C to quit..."
Read-Host | Out-Null
}
}