更新到第二十三章
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
param(
|
||||
[Parameter(Mandatory = $true, ValueFromRemainingArguments = $true)]
|
||||
[string[]] $Path
|
||||
)
|
||||
|
||||
$failed = $false
|
||||
|
||||
foreach ($chapterPath in $Path) {
|
||||
if (-not (Test-Path -LiteralPath $chapterPath -PathType Leaf)) {
|
||||
Write-Error "File not found: $chapterPath"
|
||||
$failed = $true
|
||||
continue
|
||||
}
|
||||
|
||||
$text = Get-Content -LiteralPath $chapterPath -Raw -Encoding UTF8
|
||||
$body = ($text -split '\*\*\*\*', 2)[0]
|
||||
$withoutWhitespace = $body -replace '\s', ''
|
||||
$count = $withoutWhitespace.Length
|
||||
|
||||
[pscustomobject]@{
|
||||
Chapter = [IO.Path]::GetFileNameWithoutExtension($chapterPath)
|
||||
BodyCharactersWithoutWhitespace = $count
|
||||
MeetsFiveThousand = ($count -ge 5000)
|
||||
}
|
||||
|
||||
if ($count -lt 5000) {
|
||||
$failed = $true
|
||||
}
|
||||
}
|
||||
|
||||
if ($failed) {
|
||||
exit 1
|
||||
}
|
||||
Reference in New Issue
Block a user