我每天在 Windows 終端中使用 Powershell 5.1。然而,幾天后,我的 Oh My Posh 主題停止作業,并列印出一個錯誤,說它找不到我想要的主題 (iterm2),并回退到默認主題。
我已移除 ( Remove-Module -Name oh-my-posh -Force) 并重新安裝 ( Install-Module -Name oh-my-posh -Scope CurrentUser) Oh My Posh,但這并沒有解決問題。怎么解決 ?
謝謝
uj5u.com熱心網友回復:
它也發生在我身上。我通過在正確的位置手動下載主題來修復它。
如果你想讓它變得簡單,我創建了一個 powershell One-Liner 來修復它:
New-Item -Path "$home\Documents\WindowsPowerShell\Modules\oh-my-posh" -Name "themes" -ItemType Directory; Set-Location -Path "$home\Documents\WindowsPowerShell\Modules\oh-my-posh\themes"; Invoke-WebRequest -UseBasicParsing -Uri https://api.github.com/repos/JanDeDobbeleer/oh-my-posh/contents/themes | Select-Object -ExpandProperty Content | ConvertFrom-Json | ForEach-Object {$_ | Select-Object -ExpandProperty name | Select-String -Pattern ".*.omp.json"} | ForEach-Object {$_.toString().Replace(".omp.json", "")} | ForEach-Object {Invoke-WebRequest -Uri "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/$_.omp.json" -UseBasicParsing -OutFile "$_.omp.json"}
它使用 GH API 來獲取當前可用主題的串列,然后使用一些 PowerShell 魔法將它們下載到正確的位置。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/379960.html
