diff --git a/stow.sh b/stow.sh new file mode 100755 index 0000000..fe352a0 --- /dev/null +++ b/stow.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# +# Stow automatic symlinking script +# +# Invokes stow for every folder within this repository, and that's it. + +# to_stow=$(ls -l --time-style="long-iso" . | grep -E '^d' | awk '{print $8}') + +stow_dirs() { + for d in */; do + printf "stowing %s\n" "$d" + stow "$d" + done +} + +have_stow() { + type stow >/dev/null 2>&1 || printf "GNU stow needs to be installed for this script to function. Please install stow through your package manager.\n" + exit 1 +} + +while [ "$1" != "" ]; do + case "$1" in + -s | --stow) + have_stow + stow_dirs + exit + ;; + esac + shift +done