Skip to content

Commit bae6640

Browse files
committed
detection improvements
1 parent f3b7e4a commit bae6640

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

creature-fluff-tagger.ps1

+17-17
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,24 @@ function Test-Fluff {
6767
$InputObject.PSObject.Properties.Name -contains $For -and
6868
-not $InputObject.$For
6969
) -and
70-
$InputObject._copy.source -in $brew._meta.sources.json -and
7170
$InputObject._copy._mod.$For -ne "remove"
7271
) {
73-
Write-Output (Test-Fluff $brew.monsterFluff[$brew.monsterFluff.name.indexOf($InputObject._copy.name)] -For $For)
72+
if (
73+
$InputObject._copy._mod.$For.mode -in @(
74+
"appendArr"
75+
"prependArr"
76+
"replaceArr"
77+
"insertArr"
78+
"replaceOrAppendArr"
79+
"appendIfNotExistsArr"
80+
)
81+
) {
82+
Write-Output $true
83+
} elseif ($InputObject._copy.source -in $brew._meta.sources.json) {
84+
Write-Output (Test-Fluff $brew.monsterFluff[$brew.monsterFluff.name.indexOf($InputObject._copy.name)] -For $For)
85+
} else {
86+
Write-Output $false
87+
}
7488
} else {
7589
Write-Output $false
7690
}
@@ -110,21 +124,7 @@ if ((Test-Path $Path)) {
110124
if ($Log -in @("changes", "all")) {
111125
Write-Host (" Tagged " + ($target -replace '^.*[\\/]([^\\/]+[\\/][^\\/]+)$', '$1'))
112126
}
113-
(
114-
[Regex]::Replace(
115-
(ConvertTo-Json $brew -Depth 99 -Compress),
116-
"\\u(?<Value>\w{4})",
117-
{
118-
PARAM ($Matches)
119-
(
120-
[char](
121-
[int]::Parse($Matches.Groups['Value'].Value,
122-
[System.Globalization.NumberStyles]::HexNumber)
123-
)
124-
).ToString()
125-
}
126-
) -replace '', '\u2014' -replace '', '\u2013' -replace '', '\u2212'
127-
) | Out-File -FilePath $target -Encoding Utf8
127+
ConvertTo-Json $brew -Depth 99 | Out-File -FilePath $target -Encoding Utf8
128128
} elseif ($Log -in @("skips", "all")) {
129129
Write-Host (" Left unchanged " + ($target -replace '^.*[\\/]([^\\/]+[\\/][^\\/]+)$', '$1'))
130130
}

0 commit comments

Comments
 (0)