Skip to content

Instantly share code, notes, and snippets.

@tribut
Created December 11, 2023 13:03
Show Gist options
  • Save tribut/1563beef44dbae01c77bf0b34a151f96 to your computer and use it in GitHub Desktop.
Save tribut/1563beef44dbae01c77bf0b34a151f96 to your computer and use it in GitHub Desktop.
Combine multiple toml files for starship
#!/bin/bash
set -eEuo pipefail
CONF_FILE="$HOME/.config/starship.toml"
CONF_D="$HOME/.config/starship.d"
TEMPFILE="$(mktemp)"
starship preset -o "$CONF_D/99-nerd-font-symbols.toml" nerd-font-symbols
# toml-merge always requires an "original toml" and applies patch-files (-p)
docker run --rm --network=none --user "$(id -u):$(id -g)" -v "$CONF_D:/conf:ro" -w /conf ghcr.io/mesosphere/toml-merge:v0.2.0 -p '*.toml' '10-global.toml' > "$TEMPFILE"
sed -i '1 i # Auto-generated by update-starship-config, do not edit' "$TEMPFILE"
mv "$TEMPFILE" "$CONF_FILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment