From ef396d6c1aa53cc42aafab3a3dd4582eddc37524 Mon Sep 17 00:00:00 2001 From: Bram Kelchtermans Date: Thu, 27 Jun 2024 22:04:59 +0200 Subject: [PATCH] refactor: Update starship.toml file path and add optional icon parameter in setup.sh --- setup.sh | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/setup.sh b/setup.sh index c53eb8f8..8e816c4e 100644 --- a/setup.sh +++ b/setup.sh @@ -31,20 +31,10 @@ configure_starship() { # Function to overwrite starship.toml 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 + if [ -f "./terminal/starship.toml" ]; then echo "Overwriting starship.toml..." - - # Insert icon before hostname if provided - if [ -n "$icon" ]; then - sed -i "s/format = \"\"\"/format = \"\"\"\[ $icon \](fg:color_fg0)\\n/" "$starship_toml_path" - fi - - mkdir -p $(dirname "$destination_path") - cp "$starship_toml_path" "$destination_path" + mkdir -p ~/.config/starship + cp ./terminal/starship.toml ~/.config/starship.toml else echo "starship.toml not found in the repository." exit 1 @@ -56,18 +46,6 @@ install_fish set_default_fish install_starship configure_starship - -# Check for the optional icon parameter -icon_param="" -while getopts ":i:" opt; then - case $opt in - i) icon_param="$OPTARG" - ;; - \?) echo "Invalid option -$OPTARG" >&2 - ;; - esac -done - -overwrite_starship_toml "$icon_param" +overwrite_starship_toml echo "Fish shell and Starship prompt setup complete!"