refactor: Update starship.toml file path and add optional icon parameter in setup.sh
This commit is contained in:
parent
b063bf304d
commit
810c8253c2
5
setup.sh
5
setup.sh
|
@ -33,17 +33,18 @@ configure_starship() {
|
||||||
overwrite_starship_toml() {
|
overwrite_starship_toml() {
|
||||||
local icon="$1"
|
local icon="$1"
|
||||||
local starship_toml_path="./terminal/starship.toml"
|
local starship_toml_path="./terminal/starship.toml"
|
||||||
|
local destination_path="$HOME/.config/starship.toml"
|
||||||
|
|
||||||
if [ -f "$starship_toml_path" ]; then
|
if [ -f "$starship_toml_path" ]; then
|
||||||
echo "Overwriting starship.toml..."
|
echo "Overwriting starship.toml..."
|
||||||
mkdir -p ~/.config/starship
|
|
||||||
|
|
||||||
# Insert icon before hostname if provided
|
# Insert icon before hostname if provided
|
||||||
if [ -n "$icon" ]; then
|
if [ -n "$icon" ]; then
|
||||||
sed -i "s/format = \"\"\"/format = \"\"\"\[ $icon \](fg:color_fg0)\\n/" "$starship_toml_path"
|
sed -i "s/format = \"\"\"/format = \"\"\"\[ $icon \](fg:color_fg0)\\n/" "$starship_toml_path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp "$starship_toml_path" ~/.config/starship/starship.toml
|
mkdir -p $(dirname "$destination_path")
|
||||||
|
cp "$starship_toml_path" "$destination_path"
|
||||||
else
|
else
|
||||||
echo "starship.toml not found in the repository."
|
echo "starship.toml not found in the repository."
|
||||||
exit 1
|
exit 1
|
||||||
|
|
Loading…
Reference in New Issue