Last active
April 19, 2024 19:58
-
-
Save jfhbrook/35ccb86af818f4ebbb8ec632e3b9cc55 to your computer and use it in GitHub Desktop.
Select an oh-my-posh theme (MacOS + Homebrew)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Initialize-Omp { | |
param( | |
[string] $Config, | |
[string] $Theme | |
) | |
$OmpPath = "$(brew --prefix oh-my-posh)" | |
if ($Theme) { | |
$Config = "$OmpPath/themes/$Theme.omp.json" | |
} | |
if ($Config -eq "") { | |
oh-my-posh init pwsh | Invoke-Expression | |
} else { | |
oh-my-posh init pwsh --config "$Config" | Invoke-Expression | |
} | |
} | |
function Select-OmpTheme { | |
$OmpPath = "$(brew --prefix oh-my-posh)" | |
$Theme = (Get-ChildItem "$OmpPath/themes").Name | fzf | |
if ($Theme -eq "") { | |
Write-Warning "No theme selected." | |
} else { | |
oh-my-posh init pwsh --config "$OmpPath/themes/$Theme" | Invoke-Expression | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment