36 lines
1.0 KiB
PowerShell
36 lines
1.0 KiB
PowerShell
param(
|
|
[string]$Destination = "$env:USERPROFILE\Documents\SKILL管理\个人知识库"
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$repoRoot = Resolve-Path (Join-Path $PSScriptRoot "..")
|
|
$source = Join-Path $repoRoot "knowledge-base"
|
|
|
|
if (-not (Test-Path -LiteralPath $source)) {
|
|
throw "knowledge-base snapshot not found: $source"
|
|
}
|
|
|
|
New-Item -ItemType Directory -Force -Path $Destination | Out-Null
|
|
Get-ChildItem -LiteralPath $source -Force | ForEach-Object {
|
|
Copy-Item -Recurse -Force -LiteralPath $_.FullName -Destination $Destination
|
|
}
|
|
|
|
$obsidian = Join-Path $Destination ".obsidian"
|
|
New-Item -ItemType Directory -Force -Path $obsidian | Out-Null
|
|
|
|
$appJson = Join-Path $obsidian "app.json"
|
|
if (-not (Test-Path -LiteralPath $appJson)) {
|
|
@'
|
|
{
|
|
"alwaysUpdateLinks": true,
|
|
"showLineNumber": false,
|
|
"newFileLocation": "folder",
|
|
"newFileFolderPath": "00-Inbox"
|
|
}
|
|
'@ | Set-Content -Encoding UTF8 -LiteralPath $appJson
|
|
}
|
|
|
|
Write-Host "Knowledge base restored to: $Destination"
|
|
Write-Host "Open this folder as an Obsidian Vault."
|