Skip to content

Commit

Permalink
Add migration support
Browse files Browse the repository at this point in the history
Auto migrate from YAML to TOML for alacritty >= 0.13.0

Co-authored-by: RazoBeckett <[email protected]>
  • Loading branch information
adamperkowski and RazoBeckett committed Sep 13, 2024
1 parent 142d084 commit 16f8d15
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions tabs/applications-setup/alacritty-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,23 @@ setupAlacritty() {
echo "alacritty is already installed."
fi

alacritty_version=$(alacritty --version | awk '{print $2}')
if [ "$(printf '%s\n' "$alacritty_version" "0.13.0" | sort -V | head -n1)" != "0.13.0" ]; then # Check if alacritty is >= 0.13.0 https://alacritty.org/changelog_0_13_0.html#Changed
echo
echo "Only alacritty >= 0.13.0 is supported."
exit 1
fi

echo "Copy alacritty config files"
if [ -d "${HOME}/.config/alacritty" ]; then
cp -r "${HOME}/.config/alacritty" "${HOME}/.config/alacritty-bak"
fi
mkdir -p "${HOME}/.config/alacritty/"
wget -O "${HOME}/.config/alacritty/alacritty.toml" "https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/alacritty/alacritty.toml"
wget -O "${HOME}/.config/alacritty/nordic.toml" "https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/alacritty/nordic.toml"
wget -O "${HOME}/.config/alacritty/alacritty.yml" "https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/alacritty/alacritty.yml"
wget -O "${HOME}/.config/alacritty/nordic.yml" "https://github.com/ChrisTitusTech/dwm-titus/raw/main/config/alacritty/nordic.yml"

alacritty_version=$(alacritty --version | awk '{print $2}')
if [ "$(printf '%s\n' "$alacritty_version" "0.13.0" | sort -V | head -n1)" = "0.13.0" ]; then # Check if alacritty is < 0.13.0 https://alacritty.org/changelog_0_13_0.html#Changed
echo "Alacritty version is gearter or equal to 0.13.0, migrating config files..."
if alacritty migrate; then
command rm -f "${HOME}/.config/alacritty/*.yml" # Using 'command' to avoid alias
else
echo "Failed to migrate alacritty config files."
fi
fi
}

checkEnv
Expand Down

0 comments on commit 16f8d15

Please sign in to comment.