@@ -642,23 +642,28 @@ $scriptblock = {
642642}
643643Register-ArgumentCompleter - Native - CommandName dotnet - ScriptBlock $scriptblock
644644
645- # Oh My Posh initialization with local theme fallback and auto-download
646- $localThemePath = Join-Path (Get-ProfileDir ) " cobalt2.omp.json"
647- if (-not (Test-Path $localThemePath )) {
648- # Try to download the theme file to the detected local path
649- $themeUrl = " https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/cobalt2.omp.json"
650- try {
651- Invoke-RestMethod - Uri $themeUrl - OutFile $localThemePath
652- Write-Host " Downloaded missing Oh My Posh theme to $localThemePath "
653- } catch {
654- Write-Warning " Failed to download theme file. Falling back to remote theme. Error: $_ "
655- }
656- }
657- if (Test-Path $localThemePath ) {
658- oh- my- posh init pwsh -- config $localThemePath | Invoke-Expression
645+ # If function "Get-Theme_Override" is defined in profile.ps1 file, call it instead.
646+ if (Get-Command - Name " Get-Theme_Override" - ErrorAction SilentlyContinue) {
647+ Get-Theme_Override
659648} else {
660- # Fallback to remote theme if local file doesn't exist
661- oh- my- posh init pwsh -- config https:// raw.githubusercontent.com / JanDeDobbeleer/ oh- my- posh/ main/ themes/ cobalt2.omp.json | Invoke-Expression
649+ # Oh My Posh initialization with local theme fallback and auto-download
650+ $localThemePath = Join-Path (Get-ProfileDir ) " cobalt2.omp.json"
651+ if (-not (Test-Path $localThemePath )) {
652+ # Try to download the theme file to the detected local path
653+ $themeUrl = " https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/cobalt2.omp.json"
654+ try {
655+ Invoke-RestMethod - Uri $themeUrl - OutFile $localThemePath
656+ Write-Host " Downloaded missing Oh My Posh theme to $localThemePath "
657+ } catch {
658+ Write-Warning " Failed to download theme file. Falling back to remote theme. Error: $_ "
659+ }
660+ }
661+ if (Test-Path $localThemePath ) {
662+ oh- my- posh init pwsh -- config $localThemePath | Invoke-Expression
663+ } else {
664+ # Fallback to remote theme if local file doesn't exist
665+ oh- my- posh init pwsh -- config https:// raw.githubusercontent.com / JanDeDobbeleer/ oh- my- posh/ main/ themes/ cobalt2.omp.json | Invoke-Expression
666+ }
662667}
663668
664669if (Get-Command zoxide - ErrorAction SilentlyContinue) {
0 commit comments