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
-s | --stow)
have_stow
echo "Creating dotfile symlinks ................................................."
stow_dirs
echo "Done creating symlinks ...................................................."
exit 0
;;
-d | --delete)
have_stow
echo "Removing dotfile symlinks ................................................."
unstow_dirs
echo "Done removing symlinks ...................................................."
exit 0
;;
-n | --dry-run)
have_stow
echo "Printing processed directories ............................................"
dryrun
echo "Done printing directories ................................................."
exit 0
;;
-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 | *)
usage
@ -43,6 +37,7 @@ main() {
}
stow_dirs() {
printf "Creating dotfile symlinks .................................................\n"
for d in */; do
if is_ignored "$d"; then
@ -53,9 +48,11 @@ stow_dirs() {
printf "stowing %s\n" "$d"
stow -S -t ~ "$d"
done
printf "Done creating symlinks ....................................................\n"
}
unstow_dirs() {
printf "Removing dotfile symlinks .................................................\n"
for d in */; do
if is_ignored "$d"; then
@ -66,9 +63,11 @@ unstow_dirs() {
printf "unstowing %s\n" "$d"
stow -D -t ~ "$d"
done
printf "Done removing symlinks ....................................................\n"
}
dryrun() {
printf "Printing processed directories ............................................\n"
for d in */; do
if is_ignored "$d"; then
@ -78,7 +77,7 @@ dryrun() {
printf "processing %s\n" "$d"
done
echo "Done printing directories ................................................."
printf "Done printing directories .................................................\n"
}
is_ignored() {