refactor: Update starship.toml file path and add optional icon parameter in setup.sh
This commit is contained in:
		
							
								
								
									
										6
									
								
								setup.sh
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								setup.sh
									
									
									
									
									
								
							| @@ -35,7 +35,7 @@ install_fish() { | ||||
|     sudo apt update | ||||
|     sudo apt install -y fish | ||||
| } | ||||
|  | ||||
|   | ||||
| # Function to set Fish as the default shell | ||||
| set_default_fish() { | ||||
|     echo "Setting Fish as the default shell..." | ||||
| @@ -60,14 +60,14 @@ overwrite_starship_toml() { | ||||
|     if [ -f "./terminal/starship.toml" ]; then | ||||
|         echo "Overwriting starship.toml..." | ||||
|         mkdir -p ~/.config/starship | ||||
|         cp ./terminal/starship.toml ~/.config/starship/starship.toml | ||||
|         cp ./terminal/starship.toml ~/.config/starship.toml | ||||
|          | ||||
|         # Check if icon parameter is provided | ||||
|         if [ ! -z "$icon" ]; then | ||||
|             echo "Adding icon [$icon](bg:color_purple fg:color_white) to starship.toml..." | ||||
|             # Escape special characters in icon variable for sed | ||||
|             escaped_icon=$(printf '%s\n' "$icon" | sed -e 's/[]\/$*.^[]/\\&/g') | ||||
|             sed -i "5i\icon = \"$escaped_icon\"" ~/.config/starship/starship.toml | ||||
|             sed -i "5i\icon = \"$escaped_icon\"" ~/.config/starship.toml | ||||
|         fi | ||||
|  | ||||
|     else | ||||
|   | ||||
		Reference in New Issue
	
	Block a user