* feat: nerd-fonts modules * feat: nerd-fonts modules * feat: fonts module * fix: fonts module readme * chore: fonts module readme * chore: fonts module * chore: fonts module * Update nerd-fonts.sh * Update google-fonts.sh * chore: scripts * docs: unify font module grammar with other modules fixes some misc grammar mistakes and makes documentation more inline with that of other modules * refactor: move download.sh to root directory this removes the need of the font source scripts to have an environment variable with path to the ./scripts directory making them more portable * fix: get correct download.sh path (relative to currently running script) * chore: rm loop making .sh in scripts/ executable this is not needed, as download.sh was moved and is called with bash --------- Co-authored-by: xyny <60004820+xynydev@users.noreply.github.com>
39 lines
516 B
Bash
39 lines
516 B
Bash
#!/usr/bin/env bash
|
|
set -oue pipefail
|
|
|
|
NAME=$1
|
|
FORMAT=$2
|
|
URL=$3
|
|
DEST=$4
|
|
|
|
mkdir -p "$DEST"
|
|
|
|
DOWNLOAD=$(ls "$DEST" | wc -l)
|
|
FILE="$NAME.$FORMAT"
|
|
|
|
if [[ $DOWNLOAD -eq 0 ]]; then
|
|
|
|
echo "Downloading $FILE"
|
|
|
|
curl -o "$FILE" -OL "$URL"
|
|
|
|
if [[ -f "$FILE" ]]; then
|
|
|
|
case $FORMAT in
|
|
|
|
tar.xz) tar xvJf "$FILE" -C "$DEST" ;;
|
|
zip) unzip "$FILE" -d "$DEST" ;;
|
|
|
|
esac
|
|
|
|
rm -rf "$FILE"
|
|
|
|
echo "$FILE downloaded"
|
|
|
|
else
|
|
|
|
echo "Unable to download $FILE"
|
|
|
|
fi
|
|
|
|
fi
|