Commit a67ba65d authored by Eric Timmons's avatar Eric Timmons
Browse files

cli less work: find

parent 9271dd71
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@
          #:clpm-cli/commands/config
          #:clpm-cli/commands/context
          #:clpm-cli/commands/exec
          #:clpm-cli/commands/find
          #:clpm-cli/commands/hack
          #:clpm-cli/commands/install
          #:clpm-cli/commands/license-info

cli/commands/find.lisp

0 → 100644
+31 −0
Original line number Diff line number Diff line
;;;; clpm find
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.

(uiop:define-package #:clpm-cli/commands/find
    (:use #:cl
          #:alexandria
          #:clpm-cli/common-args
          #:clpm-cli/interface-defs)
  (:import-from #:adopt)
  (:import-from #:clpm))

(in-package #:clpm-cli/commands/find)

(defparameter *find-ui*
  (adopt:make-interface
   :name "clpm find"
   :summary "Common Lisp Package Manager Find"
   :usage "find [options] SYSTEM-NAME"
   :help "List the pathname to a system in the context"
   :contents (list *group-common*
                   *option-context*)))

(define-cli-command (("find") *find-ui*) (args options)
  (declare (ignore options))
  (assert (length= 1 args))
  (let ((pathname (clpm:find-system-asd-pathname (first args))))
    (when pathname
      (format t "~A~%" pathname)
      t)))
+3 −1
Original line number Diff line number Diff line
@@ -9,8 +9,8 @@
        #:clpm/bundle
        #:clpm/client
        #:clpm/config
        #:clpm/context
        #:clpm/context-diff
        #:clpm/context-queries
        #:clpm/exec
        #:clpm/install
        #:clpm/source
@@ -21,6 +21,8 @@
  (:export #:client-asd-pathname)
  ;; From config
  (:export #:config-value)
  ;; From context-queries
  (:export #:find-system-asd-pathname)
  ;; From exec
  (:export #:exec)
  ;; From install
+16 −0
Original line number Diff line number Diff line
;;;; Context Queries
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.

(uiop:define-package #:clpm/context-queries
    (:use #:cl
          #:clpm/context
          #:clpm/session)
  (:export #:find-system-asd-pathname))

(in-package #:clpm/context-queries)

(defun find-system-asd-pathname (system-name &key context)
  (with-clpm-session ()
    (context-find-system-asd-pathname (get-context context) system-name)))