2025-10-03

00:14 no more stroll It’s perfect now. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 # ===== CONFIG ===== $hostname = $env:COMPUTERNAME if ($hostname -eq "DESKTOP-KC9K3N7") { $vault = "D:\blog" } else { $vault = "D:\A\Jeapo's blog" } Set-Location -Path $vault # ===== DATE INFO ===== $yyyy = Get-Date -Format "yyyy" $month = Get-Date -Format "MMMM" $mm = Get-Date -Format "MM" $dd = Get-Date -Format "dd" $curtime = Get-Date -Format "HH:mm" $isodate = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ") $folder = Join-Path $vault "\content\diary\$yyyy\$month" $file = Join-Path $folder "$yyyy-$mm-$dd.md" # ===== Ensure folders ===== if (-not (Test-Path $folder)) { New-Item -ItemType Directory -Path $folder | Out-Null } # ===== Create file with template if missing ===== if (-not (Test-Path $file)) { @" --- title: "$yyyy-$mm-$dd" date: "$isodate" categories: - diary series: tags: mood: weather: location: rating: 1 stime: release: 0 draft: true --- "@ | Set-Content $file } # ===== Input Mode ===== # Write-Host "Wow! What did you do just now?" -ForegroundColor Cyan # Write-Host "Type your entry. Press Enter 3 times to finish." -ForegroundColor DarkGray Write-Host "`r`n### $curtime " -ForegroundColor DarkYellow -NoNewline $lines = @() $emptyCount = 0 # 记录连续空行次数 while ($true) { $line = Read-Host if ([string]::IsNullOrWhiteSpace($line)) { $emptyCount++ if ($emptyCount -ge 3) { break } $lines += "" } else { $emptyCount = 0 $lines += $line } } $entry = $lines -join "`r`n" if ($entry.Trim().Length -gt 0) { Add-Content -Path $file -Value "`r`n### $curtime $entry" Write-Host "Saved to $file" } else { Write-Host "No entry written." } 00:21 Good Night Go to bed. ...

1 min · 444 words · Jeapo