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

cli less work: source-registry

parent 6c7264ff
......@@ -17,6 +17,7 @@
#:clpm-cli/commands/install
#:clpm-cli/commands/license-info
#:clpm-cli/commands/output-translations
#:clpm-cli/commands/source-registry
#:clpm-cli/commands/sync
#:clpm-cli/commands/update
#:clpm-cli/commands/version))
......
;;;; clpm source-registry
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.
(uiop:define-package #:clpm-cli/commands/source-registry
(:use #:cl
#:alexandria
#:clpm-cli/common-args
#:clpm-cli/interface-defs)
(:import-from #:adopt)
(:import-from #:clpm))
(in-package #:clpm-cli/commands/source-registry)
(defparameter *option-source-registry-ignore-inherited-configuration*
(adopt:make-option
:source-registry-ignore-inherited
:long "ignore-inherited-configuration"
:short #\i
:help "Print a source registry form configured to ignore inherited configuration"
:reduce (constantly t)))
(defparameter *option-source-registry-inherit-env-var*
(adopt:make-option
:source-registry-inherit-env-var
:long "splice-environment"
:short #\e
:help "Print a source registry form that has the contents of the CL_SOURCE_REGISTRY environment variable spliced in. No effect if inherited configuration is ignored."
:reduce (constantly t)))
(defparameter *option-source-registry-with-client*
(adopt:make-option
:source-registry-with-client
:long "with-client"
:help "Print a source registry form that has the CLPM client included."
:reduce (constantly t)))
(defparameter *source-registry-ui*
(adopt:make-interface
:name "clpm source-registry"
:summary "Common Lisp Package Manager Source-Registry"
:usage "source-registry [options]"
:help "Print an ASDF source-registry form using the projects installed in a context"
:contents (list *group-common*
*option-context*
*option-source-registry-ignore-inherited-configuration*
*option-source-registry-inherit-env-var*
*option-source-registry-with-client*)))
(define-cli-command (("source-registry") *source-registry-ui*) (args options)
(declare (ignore args))
(with-standard-io-syntax
(let ((*print-case* :downcase))
(format t "~S~%" (clpm:source-registry
:with-client-p (gethash :source-registry-with-client options)
:ignore-inherited-source-registry (gethash :source-registry-ignore-inherited options)
:splice-inherited (and (gethash :source-registry-inherit-env-var options)
(uiop:getenv "CL_SOURCE_REGISTRY"))))))
t)
......@@ -24,7 +24,8 @@
;; From context-queries
(:export #:asd-pathnames
#:find-system-asd-pathname
#:output-translations)
#:output-translations
#:source-registry)
;; From exec
(:export #:exec)
;; From install
......
......@@ -9,7 +9,8 @@
#:clpm/session)
(:export #:asd-pathnames
#:find-system-asd-pathname
#:output-translations))
#:output-translations
#:source-registry))
(in-package #:clpm/context-queries)
......@@ -24,3 +25,13 @@
(defun output-translations (&key context)
(with-clpm-session ()
(context-output-translations (get-context context))))
(defun source-registry (&key context with-client-p
ignore-inherited-source-registry
splice-inherited)
(with-clpm-session ()
(context-to-asdf-source-registry-form
(get-context context)
:with-client with-client-p
:ignore-inherited ignore-inherited-source-registry
:splice-inherited splice-inherited)))
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