Clean up / Linting

This commit is contained in:
Raphire
2025-05-04 23:33:20 +02:00
parent d294eb6b7a
commit 94d67c3f54

View File

@@ -737,10 +737,9 @@ function GetUserName {
if ($global:Params.ContainsKey("User")) { if ($global:Params.ContainsKey("User")) {
return $global:Params.Item("User") return $global:Params.Item("User")
} }
else {
return $env:USERNAME return $env:USERNAME
} }
}
function CreateSystemRestorePoint { function CreateSystemRestorePoint {
@@ -756,7 +755,6 @@ function CreateSystemRestorePoint {
} }
if ($recentRestorePoints.Count -eq 0) { if ($recentRestorePoints.Count -eq 0) {
try { try {
Checkpoint-Computer -Description "Restore point created by Win11Debloat" -RestorePointType "MODIFY_SETTINGS" Checkpoint-Computer -Description "Restore point created by Win11Debloat" -RestorePointType "MODIFY_SETTINGS"
Write-Output "System restore point created successfully" Write-Output "System restore point created successfully"
@@ -1408,15 +1406,15 @@ else {
PrintHeader 'Custom Mode' PrintHeader 'Custom Mode'
} }
# If the number of keys in SPParams equals the number of keys in Params then no modifications/changes were selected # If the number of keys in SPParams equals the number of keys in Params then no modifications/changes were selected
# or added by the user, and the script can exit without making any changes. # or added by the user, and the script can exit without making any changes.
if ($SPParamCount -eq $global:Params.Keys.Count) { if ($SPParamCount -eq $global:Params.Keys.Count) {
Write-Output "The script completed without making any changes." Write-Output "The script completed without making any changes."
AwaitKeyToExit AwaitKeyToExit
Exit
} }
else {
# Execute all selected/provided parameters # Execute all selected/provided parameters
switch ($global:Params.Keys) { switch ($global:Params.Keys) {
'CreateRestorePoint' { 'CreateRestorePoint' {
@@ -1652,4 +1650,3 @@ else {
Write-Output "Script completed! Please check above for any errors." Write-Output "Script completed! Please check above for any errors."
AwaitKeyToExit AwaitKeyToExit
}