Commit 0d378cfa authored by Eric Timmons's avatar Eric Timmons
Browse files

Remove context subcommands

parent c485bef9
......@@ -10,7 +10,6 @@
#:clpm-cli/commands/client
#:clpm-cli/commands/clpi
#:clpm-cli/commands/config
#:clpm-cli/commands/context
#:clpm-cli/commands/exec
#:clpm-cli/commands/find
#:clpm-cli/commands/hack
......
;;;; Context command definitions
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.
(uiop:define-package #:clpm-cli/commands/context
(:use #:cl
#:clpm-cli/commands/context/common
#:clpm-cli/commands/context/find
#:clpm-cli/commands/context/output-translations
#:clpm-cli/commands/context/pathnames
#:clpm-cli/commands/context/source-registry
#:clpm-cli/commands/context/systems
#:clpm-cli/commands/context/visible-systems))
(in-package #:clpm-cli/commands/context)
;;;; Common context CLI functions
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.
(uiop:define-package #:clpm-cli/commands/context/common
(:use #:cl
#:alexandria
#:clpm-cli/common-args
#:clpm-cli/interface-defs)
(:import-from #:adopt)
(:import-from #:cl-ppcre))
(in-package #:clpm-cli/commands/context/common)
(defparameter *default-ui*
(adopt:make-interface
:name "clpm context"
:summary "Common Lisp Package Manager Context"
:usage "context [options] subcommand"
:help "Context commands"
:contents (list *group-common*)))
(define-cli-command-folder (("context") *default-ui*))
;;;; clpm context find
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.
(uiop:define-package #:clpm-cli/commands/context/find
(:use #:cl
#:alexandria
#:clpm/config
#:clpm/context
#:clpm-cli/commands/context/common
#:clpm-cli/common-args
#:clpm-cli/interface-defs
#:clpm/source)
(:import-from #:adopt))
(in-package #:clpm-cli/commands/context/find)
(defparameter *context-find-ui*
(adopt:make-interface
:name "clpm context find"
:summary "Common Lisp Package Manager Context Find"
:usage "context find [options] SYSTEM-NAME"
:help "List the pathname to a system in the context"
:contents (list *group-common*
*option-context*)))
(define-cli-command (("context" "find") *context-find-ui*) (args options)
(declare (ignore options))
(assert (length= 1 args))
(let* ((context-name (config-value :context))
(pathname (context-find-system-asd-pathname context-name (first args))))
(when pathname
(format t "~A~%" pathname)
t)))
;;;; clpm context output-translations
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.
(uiop:define-package #:clpm-cli/commands/context/output-translations
(:use #:cl
#:alexandria
#:clpm/context
#:clpm-cli/commands/context/common
#:clpm-cli/common-args
#:clpm-cli/interface-defs)
(:import-from #:adopt))
(in-package #:clpm-cli/commands/context/output-translations)
(defparameter *context-output-translations-ui*
(adopt:make-interface
:name "clpm context output-translations"
:summary "Common Lisp Package Manager Context Output-Translations"
:usage "context output-translations [options] CONTEXT-NAME"
:help "Print an ASDF output-translations form using the projects installed in a context"
:contents (list *group-common*)))
(define-cli-command (("context" "output-translations") *context-output-translations-ui*) (args options)
(declare (ignore options))
(assert (length= 1 args))
(when-let ((output-translations (context-output-translations (first args))))
(with-standard-io-syntax
(let ((*print-case* :downcase))
(prin1 output-translations))
(terpri)))
t)
;;;; clpm context pathnames
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.
(uiop:define-package #:clpm-cli/commands/context/pathnames
(:use #:cl
#:alexandria
#:clpm/context
#:clpm-cli/commands/context/common
#:clpm-cli/common-args
#:clpm-cli/interface-defs)
(:import-from #:adopt))
(in-package #:clpm-cli/commands/context/pathnames)
(defparameter *context-pathnames-ui*
(adopt:make-interface
:name "clpm context pathnames"
:summary "Common Lisp Package Manager Context Pathnames"
:usage "context pathnames [options] CONTEXT-NAME"
:help "List the pathnames to all ASD files in the context"
:contents (list *group-common*)))
(define-cli-command (("context" "pathnames") *context-pathnames-ui*) (args options)
(declare (ignore options))
(assert (length= 1 args))
(format t "~{~A~^~%~}" (context-asd-pathnames (first args)))
t)
;;;; clpm context 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/context/source-registry
(:use #:cl
#:alexandria
#:clpm/context
#:clpm-cli/commands/context/common
#:clpm-cli/common-args
#:clpm-cli/interface-defs)
(:import-from #:adopt))
(in-package #:clpm-cli/commands/context/source-registry)
(defparameter *option-context-source-registry-ignore-inherited-configuration*
(adopt:make-option
:context-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-context-source-registry-inherit-env-var*
(adopt:make-option
:context-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-context-source-registry-with-client*
(adopt:make-option
:context-source-registry-with-client
:long "with-client"
:help "Print a source registry form that has the CLPM client included."
:reduce (constantly t)))
(defparameter *context-source-registry-ui*
(adopt:make-interface
:name "clpm context source-registry"
:summary "Common Lisp Package Manager Context Source-Registry"
:usage "context source-registry [options] CONTEXT-NAME"
:help "Print an ASDF source-registry form using the projects installed in a context"
:contents (list *group-common*
*option-context-source-registry-ignore-inherited-configuration*
*option-context-source-registry-inherit-env-var*
*option-context-source-registry-with-client*)))
(define-cli-command (("context" "source-registry") *context-source-registry-ui*) (args options)
(assert (length= 1 args))
(with-standard-io-syntax
(let ((*print-case* :downcase))
(prin1 (context-to-asdf-source-registry-form
(first args)
:with-client (gethash :context-source-registry-with-client options)
:ignore-inherited (gethash :context-source-registry-ignore-inherited options)
:splice-inherited (and (gethash :context-source-registry-inherit-env-var options)
(uiop:getenv "CL_SOURCE_REGISTRY")))))
(terpri))
t)
;;;; clpm context systems
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.
(uiop:define-package #:clpm-cli/commands/context/systems
(:use #:cl
#:alexandria
#:clpm/context
#:clpm-cli/commands/context/common
#:clpm-cli/common-args
#:clpm-cli/interface-defs
#:clpm/source)
(:import-from #:adopt))
(in-package #:clpm-cli/commands/context/systems)
(defparameter *context-systems-ui*
(adopt:make-interface
:name "clpm context systems"
:summary "Common Lisp Package Manager Context Systems"
:usage "context systems [options] CONTEXT-NAME"
:help "List the names of all systems installed in the context, one per line"
:contents (list *group-common*)))
(define-cli-command (("context" "systems") *context-systems-ui*) (args options)
(declare (ignore options))
(assert (length= 1 args))
(format t "~{~A~%~}" (sort (mapcar #'system-name (context-installed-systems (first args)))
#'string<))
t)
;;;; clpm context visible-systems
;;;;
;;;; This software is part of CLPM. See README.org for more information. See
;;;; LICENSE for license information.
(uiop:define-package #:clpm-cli/commands/context/visible-systems
(:use #:cl
#:alexandria
#:clpm/context
#:clpm-cli/commands/context/common
#:clpm-cli/common-args
#:clpm-cli/interface-defs
#:clpm/source)
(:import-from #:adopt))
(in-package #:clpm-cli/commands/context/visible-systems)
(defparameter *context-visible-systems-ui*
(adopt:make-interface
:name "clpm context visible-systems"
:summary "Common Lisp Package Manager Context Visible-Systems"
:usage "context visible-systems [options] CONTEXT-NAME"
:help "List the primary names of all systems visible to ASDF in the context, one per line"
:contents (list *group-common*)))
(define-cli-command (("context" "visible-systems") *context-visible-systems-ui*) (args options)
(declare (ignore options))
(assert (length= 1 args))
(format t "~{~A~%~}" (sort (context-visible-primary-system-names (first args))
#'string<))
t)
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