Commit 005899a7 authored by Eric Timmons's avatar Eric Timmons
Browse files

Reduce work CLI files do for context pathnames and find

parent c12fefce
......@@ -28,16 +28,7 @@
(define-cli-command (("context" "find") *context-find-ui*) (args options)
(assert (length= 1 args))
(let* ((context-name (gethash :context options "default"))
(context (get-context context-name))
(system-release (find (first args) (context-system-releases context)
:key (compose #'system-name #'system-release-system)
:test #'equal)))
(when system-release
(eswitch ((gethash :output options) :test 'equal)
(nil
(format t "~A~%" (system-release-absolute-asd-pathname system-release)))
("sexp"
(uiop:with-safe-io-syntax ()
(prin1 (system-release-absolute-asd-pathname system-release))
(terpri))))
(pathname (context-find-system-asd-pathname context-name (first args))))
(when pathname
(format t "~A~%" pathname)
t)))
......@@ -25,13 +25,5 @@
(define-cli-command (("context" "pathnames") *context-pathnames-ui*) (args options)
(assert (length= 1 args))
(let* ((context (get-context (first args)))
(context-pathnames (context-asd-pathnames context)))
(eswitch ((gethash :output options) :test 'equal)
(nil
(format t "~{~A~^~%~}" context-pathnames))
("sexp"
(uiop:with-safe-io-syntax ()
(prin1 context-pathnames)
(terpri))))
t))
(format t "~{~A~^~%~}" (context-asd-pathnames (first args)))
t)
......@@ -18,6 +18,7 @@
#:context-diff
#:context-diff-has-diff-p
#:context-diff-to-plist
#:context-find-system-asd-pathname
#:context-installed-only-p
#:context-name
#:context-releases
......@@ -130,7 +131,8 @@ in place with the same name. Return the new requirement if it was modified."
;; * ASDF Integration
(defun context-asd-pathnames (context)
(let* ((releases (context-releases context))
(let* ((context (get-context context))
(releases (context-releases context))
(system-files (flatten (mapcar #'release-system-files releases))))
(mapcar #'system-file-absolute-asd-pathname system-files)))
......@@ -146,6 +148,13 @@ in place with the same name. Return the new requirement if it was modified."
,@(context-to-asdf-source-registry.d-forms context)
,@extra-forms))
(defun context-find-system-asd-pathname (context system-name)
(when-let* ((context (get-context context))
(system-release (find system-name (context-system-releases context)
:key (compose #'system-name #'system-release-system)
:test #'equal)))
(system-release-absolute-asd-pathname system-release)))
(defun context-write-asdf-files (context)
(assert (context-name context))
(let* ((name (context-name context))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment