emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 2f5bfc0 144/348: counsel.el (counsel-dpkg): New command


From: Oleh Krehel
Subject: [elpa] master 2f5bfc0 144/348: counsel.el (counsel-dpkg): New command
Date: Sat, 8 Apr 2017 11:03:44 -0400 (EDT)

branch: master
commit 2f5bfc09639064b5f7407e6d8b8ab87836ea3161
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>

    counsel.el (counsel-dpkg): New command
---
 counsel.el | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/counsel.el b/counsel.el
index aa1106b..89584fe 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1475,6 +1475,27 @@ INITIAL-INPUT can be given as the initial minibuffer 
input."
             :unwind #'counsel-delete-process
             :caller 'counsel-locate))
 
+;;** `counsel-dpkg'
+;;;###autoload
+(defun counsel-dpkg ()
+  "Call the \"dpkg\" shell command."
+  (interactive)
+  (let ((cands (mapcar
+                (lambda (x)
+                  (let ((y (split-string x "  +")))
+                    (setq col1 (max col1 (length (nth 1 y))))
+                    (cons (format "%-40s   %s"
+                                  (ivy--truncate-string
+                                   (nth 1 y) 40)
+                                  (nth 4 y))
+                          (mapconcat #'identity y " "))))
+                (split-string
+                 (shell-command-to-string "dpkg -l | tail -n+6") "\n" t))))
+    (ivy-read "dpkg: " cands
+              :action (lambda (x)
+                        (message (cdr x)))
+              :caller 'counsel-dpkg)))
+
 ;;** File Jump and Dired Jump
 
 ;;;###autoload



reply via email to

[Prev in Thread] Current Thread [Next in Thread]