branch: master
commit df9ad89bec43777513b3f0efe031cd81dcf47820
Author: Omair Majid <[email protected]>
Commit: Oleh Krehel <[email protected]>

    counsel.el (counsel-rpm): New command
    
    Fixes #695
---
 counsel.el | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/counsel.el b/counsel.el
index cb1da76..e4ade60 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1537,6 +1537,26 @@ INITIAL-INPUT can be given as the initial minibuffer 
input."
                         (message (cdr x)))
               :caller 'counsel-dpkg)))
 
+;;** `counsel-rpm'
+;;;###autoload
+(defun counsel-rpm ()
+  "Call the \"rpm\" shell command."
+  (interactive)
+  (let ((cands (mapcar
+                (lambda (x)
+                  (let ((y (split-string x "|")))
+                    (cons (format "%-40s   %s"
+                                  (ivy--truncate-string
+                                   (nth 0 y) 40)
+                                  (nth 1 y))
+                          (mapconcat #'identity y " "))))
+                (split-string
+                 (shell-command-to-string "rpm -qa --qf 
\"%{NAME}|%{SUMMARY}\\n\"") "\n" t))))
+    (ivy-read "rpm: " cands
+              :action (lambda (x)
+                        (message (cdr x)))
+              :caller 'counsel-rpm)))
+
 ;;** File Jump and Dired Jump
 
 ;;;###autoload

Reply via email to