From 546e3b18043ba424b661cff773c388a3931305e2 Mon Sep 17 00:00:00 2001 From: dx Date: Sun, 17 May 2020 09:26:37 +0100 Subject: +support for deleting a modules Refactored the code a bit to make it a bit cleaner, added support for deleting modules in dotfiles --- Install.org | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/Install.org b/Install.org index dc734e5..4808922 100644 --- a/Install.org +++ b/Install.org @@ -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. -- cgit v1.2.3-13-gbd6f