#!/bin/bash function do_stow() { local package="$1" local opts=( "--dotfiles" "--dir" "${DOTFILES_DIR}" ) if [[ "$#" -ge 2 ]]; then opts+=( "--target" "$2" ) fi stow "${opts[@]}" "$package" } set -eo pipefail DOTFILES_DIR="$(dirname -- "$(realpath -- "${BASH_SOURCE[0]}")")" TARGET_DIR="$HOME" if ! command -v stow &> /dev/null; then echo "[!] Stow is not installed!" exit 1 fi # Install SSH separately, as it requres a different target. do_stow ssh "${TARGET_DIR}/.ssh" do_stow tmux do_stow git do_stow zsh do_stow nvim "${TARGET_DIR}/.config" echo "[+] Installed!"