diff --git a/src/bin/dotify b/src/bin/dotify index cbde7a7..6a94e38 100755 --- a/src/bin/dotify +++ b/src/bin/dotify @@ -40,6 +40,7 @@ source "../lib/trim.sh" source "../lib/internals/compile-dotfile.sh" source "../lib/internals/create-symlink.sh" +source "../lib/internals/execute-dotfile.sh" source "../lib/internals/locate-dotfile.sh" source "../lib/internals/locate-target.sh" source "../lib/internals/parse-dotfile-options.sh" diff --git a/src/lib/dotify-clean.sh b/src/lib/dotify-clean.sh new file mode 100644 index 0000000..23580a2 --- /dev/null +++ b/src/lib/dotify-clean.sh @@ -0,0 +1,5 @@ +dotify-clean() { + DOTIFY_RUN_MODE="clean" + execute-dotfile + return $? +} diff --git a/src/lib/dotify-install.sh b/src/lib/dotify-install.sh index 8cef231..9ff3b8a 100644 --- a/src/lib/dotify-install.sh +++ b/src/lib/dotify-install.sh @@ -1,10 +1,5 @@ dotify-install() { - locate-dotfile - if [ -n "$?" ]; then return 1; fi - - locate-target - if [ -n "$?" ]; then return 1; fi - + DOTIFY_RUN_MODE="install" execute-dotfile return $? } diff --git a/src/lib/dotify-uninstall.sh b/src/lib/dotify-uninstall.sh new file mode 100644 index 0000000..e845e56 --- /dev/null +++ b/src/lib/dotify-uninstall.sh @@ -0,0 +1,5 @@ +dotify-uninstall() { + DOTIFY_RUN_MODE="uninstall" + execute-dotfile + return $? +} diff --git a/src/lib/internals/execute-dotfile.sh b/src/lib/internals/execute-dotfile.sh new file mode 100644 index 0000000..051e721 --- /dev/null +++ b/src/lib/internals/execute-dotfile.sh @@ -0,0 +1,9 @@ +execute-dotfile() { + local dotfile_source="$(dotify-compile)" + + locate-target + if [ "$?" != "0" ]; then return 1; fi + + echo "$dotfile_source" + return $? +}