#!/bin/sh -e
#
# alacritty-theme - set/select alacritty theme

if command -v gfind >/dev/null 2>&1; then

  if [ -e "${HOME}"/.config/alacritty/themes/"$1".toml ]; then
    ln -f "${HOME}"/.config/alacritty/themes/"$1".toml ~/.config/alacritty/theme.toml
  else
    echo "No such theme. Select from:"
    gfind "${HOME}"/.config/alacritty/themes -printf '%f\n' | sed 's/.toml$//'
  fi

else
  printf '%s\n' "coreutils not installed."
  exit 1
fi
