refactor: Update starship.toml file path and add optional icon parameter in setup.sh

This commit is contained in:
Bram Kelchtermans 2024-06-27 21:57:47 +02:00
parent b063bf304d
commit 810c8253c2
1 changed files with 3 additions and 2 deletions

View File

@ -33,17 +33,18 @@ configure_starship() {
overwrite_starship_toml() {
local icon="$1"
local starship_toml_path="./terminal/starship.toml"
local destination_path="$HOME/.config/starship.toml"
if [ -f "$starship_toml_path" ]; then
echo "Overwriting starship.toml..."
mkdir -p ~/.config/starship
# Insert icon before hostname if provided
if [ -n "$icon" ]; then
sed -i "s/format = \"\"\"/format = \"\"\"\[ $icon \](fg:color_fg0)\\n/" "$starship_toml_path"
fi
cp "$starship_toml_path" ~/.config/starship/starship.toml
mkdir -p $(dirname "$destination_path")
cp "$starship_toml_path" "$destination_path"
else
echo "starship.toml not found in the repository."
exit 1