#!/usr/bin/env bash

# zsh-completions
conf_print_unstable_source() {
  cat <<-EOF
Types: deb
URIs: http://download.opensuse.org/repositories/shells:/zsh-users:/zsh-completions/Debian_Unstable/
Suites: /
Signed-By: /etc/apt/trusted.gpg.d/shells_zsh-users_zsh-completions_unstable.gpg
EOF
}
conf_print_unstable_source | sudo tee /etc/apt/sources.list-available/zsh-completitions_unstable.sources

curl -fsSL https://download.opensuse.org/repositories/shells:zsh-users:zsh-completions/Debian_Unstable/Release.key |
  gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/shells_zsh-users_zsh-completions_unstable.gpg >/dev/null

conf_print_testing_source() {
  cat <<-EOF
Types: deb
URIs: http://download.opensuse.org/repositories/shells:/zsh-users:/zsh-completions/Debian_Testing/
Suites: /
Signed-By: /etc/apt/trusted.gpg.d/shells_zsh-users_zsh-completions_testing.gpg
EOF
}
conf_print_testing_source | sudo tee /etc/apt/sources.list-available/zsh-completitions_testing.sources

curl -fsSL https://download.opensuse.org/repositories/shells:zsh-users:zsh-completions/Debian_Testing/Release.key |
  gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/shells_zsh-users_zsh-completions_testing.gpg >/dev/null

# Link testing
sudo ln -sf /etc/apt/sources.list-available/zsh-completitions_testing.sources /etc/apt/sources.list.d/zsh-completitions_testing.sources

# Update and install
sudo apt-get update
sudo apt-get install -y zsh-completions
