+support for deleting a modules

Refactored the code a bit to make it a bit cleaner, added support for
deleting modules in dotfiles
This commit is contained in:
dx
2020-05-17 09:26:37 +01:00
parent d483094f0c
commit 546e3b1804

View File

@@ -11,19 +11,35 @@ for pkg in $folders; do
stow $pkg
done
#+END_SRC
* Stow specific module
* Emacs support
** Get all modules in Dotfiles
The main function used to retrieve all the stowable modules in the Dotfiles directory.
#+BEGIN_SRC elisp
(defun get-modules ()
(interactive)
(cdr
(reverse
(split-string
(shell-command-to-string "find . -maxdepth 1 -type 'd' -not -name '.git' -not -name '.'")
"\n"))))
#+END_SRC
** Stow module
Little elisp snippet to stow a specific module in the Dotfiles folder using ivy.
#+BEGIN_SRC elisp
(ivy-read
"Enter module: "
(cdr
(reverse
(split-string
(shell-command-to-string "find . -maxdepth 1 -type 'd' -not -name '.git' -not -name '.'")
"\n")))
"Stow module: "
(get-modules)
:require-match t
:action (lambda (choice) (async-shell-command (format "stow %s" choice) "*stow-output*" "*stow-error*")))
#+END_SRC
** Delete module
#+BEGIN_SRC elisp
(ivy-read
"Delete module: "
(get-modules)
:require-match t
:action (lambda (choice) (async-shell-command (format "stow -D %s" choice) "*stow-output*" "*stow-error*")))
#+END_SRC
* Generate user directories
This makes some useful directories that are used by the system and/or by me. I
split these into two sections so you can execute the ones you think are useful.