The Meowgorithm Dotfiles, Collectors’ Edition
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd -- "$(dirname -- "$0")" && pwd)"
source "$SCRIPT_DIR/bash/bash_funcs"
usage() {
echo "Usage: $0 [link|remove|update] [--fetch]"
echo " --fetch Pull Git LFS objects for the fonts submodule before linking"
exit 1
}
XDG_CONFIG_HOME="$HOME/.config"
XDG_DATA_HOME="$HOME/.local/share"
# What operation to perform: link, remove, or update.
# --fetch may be given alongside any operation.
OP="link"
FETCH_LFS=0
for arg in "$@"; do
case "$arg" in
--fetch) FETCH_LFS=1 ;;
*) OP="$arg" ;;
esac
done
if [[ "$OP" != "link" && "$OP" != "remove" && "$OP" != "update" ]]; then
usage
fi
# Ensure the fonts submodule holds real font files, not LFS pointer stubs.
fetch_fonts() {
if [[ "$FETCH_LFS" != "1" ]]; then
return
fi
if [[ "$(command_exists git-lfs)" != "1" ]]; then
printf "git-lfs is not installed; skipping --fetch.\n" >&2
return
fi
git -C "$SCRIPT_DIR" submodule update --init fonts
git -C "$SCRIPT_DIR/fonts" lfs install --local