From 34779454bebcf68d6c84ef84d44c70ad5b855e69 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Mon, 30 Dec 2019 00:02:17 +0100 Subject: [PATCH] Add simple stow automatic linking script --- stow.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 stow.sh 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