]> apps.delaporte.us Git - dotfiles.git/blobdiff - bin/dot
Add help text to dot link
[dotfiles.git] / bin / dot
diff --git a/bin/dot b/bin/dot
index 16e366ef6e566eb37029d9b82c35a8300c01b7d4..4e21e72397c556d8b1a73fc9833242bc0f6edac9 100755 (executable)
--- a/bin/dot
+++ b/bin/dot
@@ -36,8 +36,8 @@ read -d '' EMPTY_TASKFILE << EOF
   connection: local
 
   tasks:
-     - name: Do nothing
-       ansible.builtin.shell: echo "Nothing to do."
+               - name: Do nothing
+      ansible.builtin.shell: echo "Nothing to do."
 EOF
 
 
@@ -60,6 +60,16 @@ if [ "$1" == "setup" ]; then
        fi
 fi
 
+if [ "$1" == "reset" ]; then
+       read -n1 -p "Reset $TASKFILE? [y,N]" input
+       if [[ ! $input == "Y" && ! $input == "y" ]]; then
+               echo "Aborted by user"
+               exit 1
+       fi
+       echo "$EMPTY_TASKFILE" > $TASKFILE
+fi
+
+
 if [ "$1" == "check" ]; then
        $ANSIBLE $TASKFILE --check --diff
 fi
@@ -72,28 +82,26 @@ fi
 
 
 
-if [ "$1" == "link" ]; then
-       echo "wait"
-fi
 
-echo << EOF
-- name: Create a symbolic link
-  ansible.builtin.file:
-    src: /file/to/link/to
-    dest: /path/to/symlink
-    owner: foo
-    group: foo
-    state: link
-EOF
 
-echo "heh"
+if [ "$1" == "link" ]; then
+       if [ ! -n "$2" ]; then
+               echo "May symlink:"
+               cd $HOME/dotfiles/files
+               ls -p | grep -v /
+       fi
 
+read -d '' LINK_FILE << EOF
+---
+  tasks:
+               - name: Create a symbolic link
+                       ansible.builtin.file:
+                               src: /file/to/link/to
+                               dest: /path/to/symlink
+                               owner: foo
+                               group: foo
+                               state: link
+EOF
 
-if [ "$1" == "reset" ]; then
-       read -n1 -p "Reset $TASKFILE? [y,N]" input
-       if [[ ! $input == "Y" && ! $input == "y" ]]; then
-               echo "Aborted by user"
-               exit 1
-       fi
-       echo "$EMPTY_TASKFILE" > $TASKFILE
 fi
+