#!/bin/bash

DIRECTORY="$(dirname "$(dirname "$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )")")"

function error {
  echo -e "\\e[91m$1\\e[39m"
  exit 1
}

echo "Adding GPG key..."
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add - || error "Failed to add GPG key for sublime-text repository!"

echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list

sudo apt update || error "Failed to run 'sudo apt update'!"

sudo apt install sublime-text || error "APT failed to install sublime-text package!"

