Increase autostow.sh version, refactor print statements

This commit is contained in:
Marty Oehme 2020-01-30 13:22:52 +01:00
parent bba4e1d71f
commit 9932202704

View file

@ -12,27 +12,21 @@ main() {
case "$1" in case "$1" in
-s | --stow) -s | --stow)
have_stow have_stow
echo "Creating dotfile symlinks ................................................."
stow_dirs stow_dirs
echo "Done creating symlinks ...................................................."
exit 0 exit 0
;; ;;
-d | --delete) -d | --delete)
have_stow have_stow
echo "Removing dotfile symlinks ................................................."
unstow_dirs unstow_dirs
echo "Done removing symlinks ...................................................."
exit 0 exit 0
;; ;;
-n | --dry-run) -n | --dry-run)
have_stow have_stow
echo "Printing processed directories ............................................"
dryrun dryrun
echo "Done printing directories ................................................."
exit 0 exit 0
;; ;;
-v | --version) -v | --version)
printf "System bootstrap script.\n\n©Marty Oehme\n\nVersion: 0.2\n" printf "System bootstrap script.\n\n©Marty Oehme\n\nVersion: 0.2.1\n"
;; ;;
-h | --help | *) -h | --help | *)
usage usage
@ -43,6 +37,7 @@ main() {
} }
stow_dirs() { stow_dirs() {
printf "Creating dotfile symlinks .................................................\n"
for d in */; do for d in */; do
if is_ignored "$d"; then if is_ignored "$d"; then
@ -53,9 +48,11 @@ stow_dirs() {
printf "stowing %s\n" "$d" printf "stowing %s\n" "$d"
stow -S -t ~ "$d" stow -S -t ~ "$d"
done done
printf "Done creating symlinks ....................................................\n"
} }
unstow_dirs() { unstow_dirs() {
printf "Removing dotfile symlinks .................................................\n"
for d in */; do for d in */; do
if is_ignored "$d"; then if is_ignored "$d"; then
@ -66,9 +63,11 @@ unstow_dirs() {
printf "unstowing %s\n" "$d" printf "unstowing %s\n" "$d"
stow -D -t ~ "$d" stow -D -t ~ "$d"
done done
printf "Done removing symlinks ....................................................\n"
} }
dryrun() { dryrun() {
printf "Printing processed directories ............................................\n"
for d in */; do for d in */; do
if is_ignored "$d"; then if is_ignored "$d"; then
@ -78,7 +77,7 @@ dryrun() {
printf "processing %s\n" "$d" printf "processing %s\n" "$d"
done done
echo "Done printing directories ................................................." printf "Done printing directories .................................................\n"
} }
is_ignored() { is_ignored() {