2 #+author: Richard Westhaver
3 #+description: Command-line Interface Library
4 #+setupfile: ../../../clean.theme
6 #+property: header-args :dir ~/comp/core/ :exports both
7 #+setupfile: ../../../clean.theme
10 :ID: fb7c1b49-e293-41b7-863c-f38eaa361080 12 The
=cli= library is a fully-featured toolkit for working with and
13 building
[[https://en.wikipedia.org/wiki/Command-line_interface][CLI]] programs.
16 :ID: 5d0f369d-5de0-41b1-8288-2633a84c3a42 18 #+begin_src lisp :results list 20 (let ((sys (asdf:find-system :cli)))
21 (asdf:system-depends-on sys))
32 :ID: 6c86510a-2c59-48a6-91c3-8533ceb0dcda 34 #+begin_src lisp :results list 36 (let ((sys (doc:system-documentation :cli)))
37 (mapcar (lambda (s) (asdf:component-name (doc:doc-system s))) (doc:doc-dependents sys)))
54 :ID: dc23dd4f-6025-40cb-90c7-982def7ef530 56 #+begin_src lisp :output replace :results list 58 (enough-namestring p (asdf:system-source-directory :cli)))
59 (doc:doc-files (doc:system-documentation :cli)))
94 :ID: c62cb04c-1c86-4bbe-bd1e-b962c887b008 96 #+begin_src lisp :output replace :results list 97 (mapcar (lambda (p) (package-name (doc:doc-package p)))
98 (doc:doc-packages (doc:system-documentation :cli)))
132 :ID: 7fa7ae69-b3a0-4bdf-907c-dacb25cb3662 134 #+begin_src lisp :output replace 135 (ql:quickload :cli/tests)
137 (print rt:*test-suite* nil)
141 : #
<RT:TEST-SUITE CLI [11:11:0:0] {1003038B23}> 143 #+begin_src lisp :output replace 144 (rt:tests rt:*test-suite*)
149 (#<RT:TEST SBCL-TOOLS :fn SBCL-TOOLS-TEST787 {100303C973}>
150 #<RT:TEST CLAP-MAIN :fn CLAP-MAIN-TEST786 {100303C8E3}>
151 #<RT:TEST CLI-AST :fn CLI-AST-TEST785 {100303C823}>
152 #<RT:TEST ENV :fn ENV-TEST784 {100303C793}>
153 #<RT:TEST REPL :fn REPL-TEST783 {100303C703}>
154 #<RT:TEST SPARK :fn SPARK-TEST782 {100303C673}>
155 #<RT:TEST PROGRESS :fn PROGRESS-TEST781 {100303C5E3}>
156 #<RT:TEST CLAP-OPTS :fn CLAP-OPTS-TEST780 {100303C553}>
157 #<RT:TEST CLAP-BASIC :fn CLAP-BASIC-TEST779 {100303C493}>
158 #<RT:TEST CLI-PROMPT :fn CLI-PROMPT-TEST778 {1003038F83}>
159 #<RT:TEST ANSI :fn ANSI-TEST777 {1003038D33}>)
165 =clap= is a name borrowed from the
[[https://github.com/clap-rs/clap][clap.rs]] Command Line Argument
166 Parser. What can I say, it's a good acronym.
168 Besides the system tests, you can find this package used in our lisp
169 applications (
=lisp/bin=).
171 =clap= provides an object protocol and classes which parse input into
172 a simple AST and execute the appropriate option and command handlers.
174 Several macros form the public API used to build a CLI including
175 =defcommand=,
=defopt=,
=define-cli=, and
=defmain=.