Skip to content
This repository was archived by the owner on Aug 16, 2025. It is now read-only.

Commit 847fe89

Browse files
committed
0.1.6
Documentation: - List garbage creation prevention instructions
1 parent 6fb3c3d commit 847fe89

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

constup-garbage-cleaner.ps1

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ param (
2424
[switch]$listEntityCategories,
2525
[switch]$listTypes,
2626
[switch]$listCustomCategories,
27+
[switch]$listInstructions,
2728
# dry run
2829
[switch]$dryRun,
2930
[switch]$detailed
@@ -105,6 +106,11 @@ if (Test-Path $cleanupListFile)
105106
}
106107
exit 0
107108
}
109+
elseif ($listInstructions)
110+
{
111+
$preventionInstructions = Show-PreventionInstructions($cleanupListFile)
112+
Write-PreventionInstructions $preventionInstructions
113+
}
108114
elseif ($dryRun)
109115
{
110116
$version = Get-Content -Path (Join-Path $PSScriptRoot ./version)

src/show-by-property.ps1

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
. (Join-Path $PSScriptRoot ./prevention-instructions.ps1)
2+
13
function Show-Applications {
24
param (
35
[Parameter(Mandatory=$true)]
@@ -95,5 +97,27 @@ function Show-CustomCategories {
9597
}
9698
}
9799

100+
return $result
101+
}
102+
103+
function Show-PreventionInstructions {
104+
param (
105+
[Parameter(Mandatory=$true)]
106+
[string]$cleanupListFile
107+
)
108+
109+
$result = New-Object System.Collections.Generic.List[object]
110+
111+
$json = Get-Content -Raw $cleanupListFile | ConvertFrom-Json
112+
$properties = $json.PsObject.Properties
113+
$properties | ForEach-Object {
114+
$instructions = $_.Value.instructions
115+
if ((-not $result.Contains($instructions)) -and (-not [String]::IsNullOrEmpty($instructions)))
116+
{
117+
$item = Add-PreventionInstructions -name $_.Name -location $_.Value.delete.location -instructions $_.Value.instructions
118+
$result.Add($item)
119+
}
120+
}
121+
98122
return $result
99123
}

0 commit comments

Comments
 (0)