Skip to content

Instantly share code, notes, and snippets.

@arnos-stuff
Created December 15, 2022 15:17
Show Gist options
  • Save arnos-stuff/b20ebdf8e69e008b71bfb32b8efff181 to your computer and use it in GitHub Desktop.
Save arnos-stuff/b20ebdf8e69e008b71bfb32b8efff181 to your computer and use it in GitHub Desktop.
self hacked code if your themes are somehow lost within your filesystem
$response = (curl "https://github.com/JanDeDobbeleer/oh-my-posh/blob/eed32ec55a392928cab6cfb52b0311677febd089/themes")
$content = $response.Content
# "/JanDeDobbeleer/oh-my-posh/blob/eed32ec55a392928cab6cfb52b0311677febd089/themes/M365Princess.omp.json"
# JanDeDobbeleer/oh-my-posh/blob/main/themes/1_shell.omp.json
$results = $content | Select-String '([a-zA-Z0-9\._\-]+)\.omp\.json' -AllMatches
$array = $results.Matches.Value
# Remove duplicates
$array = $array | Get-Unique
$api_url = "https://api.github.com/repos/JanDeDobbeleer/oh-my-posh/contents/themes/"
foreach ($theme in $array) {
# use api to get the content
$url = $api_url + $theme
curl $(gh api $url --jq .download_url) -o $theme
mkdir -p $HOME/.oh-my-posh/themes
mv $theme $HOME/.oh-my-posh/themes
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment