aboutsummaryrefslogtreecommitdiffstats
path: root/l
diff options
context:
space:
mode:
authorTeddy Wing2021-02-27 17:39:35 +0100
committerTeddy Wing2021-02-27 18:02:42 +0100
commita93a51089c514f9c52860945e0815aa61b191cc1 (patch)
treed84e548c938edc443d51bd09c35a3d48399d1212 /l
parente7cb0b8256eefa8dfa07cfee2f4335bf6a414c72 (diff)
downloadextreload-a93a51089c514f9c52860945e0815aa61b191cc1.tar.bz2
option: Add documentation
Diffstat (limited to 'l')
-rw-r--r--l/src/option.lisp8
1 files changed, 8 insertions, 0 deletions
diff --git a/l/src/option.lisp b/l/src/option.lisp
index 6965b71..3c266ea 100644
--- a/l/src/option.lisp
+++ b/l/src/option.lisp
@@ -1,19 +1,27 @@
+;;;; Command line options.
+
(in-package :extreload)
(defmacro when-option ((options option) &body body)
+ "When `option` is present in `options`, run `body`."
`(let ((value (getf ,options ,option)))
(when value
,@body)))
(defun exit-with-error (condition exit-code)
+ "Print the error associated with `condition` on standard error, then exit
+with code `exit-code`."
(format *error-output* "error: ~a~%" condition)
(opts:exit exit-code))
(defun handle-option-error (condition)
+ "Handle errors related to command line options. Prints the error specified by
+`condition` and exits with EX_USAGE."
(exit-with-error condition sysexits:+usage+))
(defun parse-options ()
+ "Parse command line options."
(multiple-value-bind (options free-args)
(handler-bind
((opts:unknown-option #'handle-option-error)