branch: externals/system-packages
commit 7c17a8b165ee2b921c4958f10c1942d706363733
Author: Alex Branham <[email protected]>
Commit: Alex Branham <[email protected]>

    Adds function to remove orphaned packages
---
 system-packages.el | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/system-packages.el b/system-packages.el
index 9855309..6946067 100644
--- a/system-packages.el
+++ b/system-packages.el
@@ -66,3 +66,15 @@
         (async-shell-command (concat "sudo " command))
       (async-shell-command command))))
 
+(defun system-packages-remove-orphaned ()
+  "This function removes orphaned packages i.e. unused packages."
+  (interactive)
+  (if (equal system-packages-packagemanager "brew")
+      (error "Not supported on homebrew"))
+  (let ((command
+         (cond ((equal system-packages-packagemanager "pacman") "pacman -Rns 
$(pacman -Qtdq)")
+               ((equal system-packages-packagemanager "apt") "apt-get 
autoremove"))))))
+    (if (equal system-packages-usesudo t)
+        (async-shell-command (concat "sudo " command))
+      (async-shell-command command))
+  

Reply via email to