#!/bin/bash

VERSION=$1

rm -f nerd-fonts-hack-*.tar.?z*

mkdir nerd-fonts-hack-$VERSION
cd nerd-fonts-hack-$VERSION

wget --content-disposition https://github.com/ryanoasis/nerd-fonts/releases/download/v$VERSION/Hack.zip

unzip Hack.zip
rm -f Hack.zip

rm -f *"Windows Compatible.ttf"

for f in *\ *; do mv "$f" "${f// /}"; done

# Remove non-Mono versions
for f in $(ls -1 *.ttf | grep -v "Mono.ttf"); do
  rm -f "$f"
done

cd ..

tar --exclude-vcs -cf nerd-fonts-hack-$VERSION.tar nerd-fonts-hack-$VERSION
plzip -9 nerd-fonts-hack-$VERSION.tar

rm -rf nerd-fonts-hack-$VERSION
