Skip to content

Instantly share code, notes, and snippets.

@rhz

rhz/gist:671969

Created Nov 11, 2010
Embed
What would you like to do?
pak -Ss QUERY
diff --git a/main.lisp b/main.lisp
index 0dfaf15..ec5730e 100644
--- a/main.lisp
+++ b/main.lisp
@@ -270,6 +270,17 @@ Returns T upon successful installation, NIL otherwise."
(get-pkgbuild pkg-name)
(quit)))))))))
+(defun search-packages (query)
+ (maybe-refresh-cache)
+ (let* ((pkglist (make-string-output-stream))
+ (bstream (make-broadcast-stream *standard-output* pkglist))
+ (packages (get-package-results query :quiet nil
+ :stream bstream))
+ (pkglist (get-output-stream-string pkglist))
+ (total (length packages)))
+ (if (null packages)
+ (info "Sorry, no packages matched ~S~%" query))))
+
(defun search-and-install-packages (query &key query-for-providers)
(maybe-refresh-cache)
(when query-for-providers
@@ -371,7 +382,8 @@ Returns T upon successful installation, NIL otherwise."
(defun display-help ()
(format t "~
Usage:
- pak QUERY # search for QUERY
+ pak QUERY # search for QUERY and prompt for installation
+ pak -Ss QUERY # search for QUERY
pak -S PACKAGE # install PACKAGE
pak -R PACKAGE # remove PACKAGE
pak -Su --aur # Upgrade all AUR packages
@@ -385,6 +397,8 @@ Usage:
(display-help))
((eql argc 1)
(search-and-install-packages (first argv)))
+ ((and (>= argc 2) (equal (first argv) "-Ss"))
+ (search-packages (apply #'concatenate 'string (cdr argv))))
((and (>= argc 2) (equal (first argv) "-S"))
(mapcar #'install-package (cdr argv)))
((and (>= argc 2) (equal (first argv) "-R"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.