Fix UNIX cli error-handling
… I made a silly, brainless mistake here. :P
This commit is contained in:
parent
e765f14583
commit
b0edcf78a4
|
@ -36,8 +36,7 @@
|
|||
;; nil → nil
|
||||
(defun main ()
|
||||
"Actual invocation of the program. This is what you should set as :toplevel."
|
||||
(error-print
|
||||
99 ""
|
||||
(handler-case
|
||||
(multiple-value-bind (opts free) (opts:get-opts)
|
||||
(when-opt opts :help (help))
|
||||
(let* ((input-stream (choose-input-stream (car free)))
|
||||
|
@ -50,7 +49,9 @@
|
|||
(mirror-img:mirror-img
|
||||
input-stream
|
||||
download-dir
|
||||
:url-dir url-base))))))
|
||||
:url-dir url-base))))
|
||||
(error (c)
|
||||
(error-print 99 nil c))))
|
||||
|
||||
(opts:define-opts
|
||||
(:name :help
|
||||
|
@ -69,6 +70,10 @@
|
|||
(error (c)
|
||||
(error-print 11 "Could not access or create directory." c))))))
|
||||
|
||||
|
||||
|
||||
;;; Output
|
||||
;;; ————————————————————————————————————————
|
||||
;; number stream → nil
|
||||
(defun help (&optional (exit-code 0) (stream *standard-output*))
|
||||
"Prints help message and dies."
|
||||
|
@ -82,7 +87,7 @@
|
|||
;; number string condition → nil
|
||||
(defun error-print (exit-code &optional message condition)
|
||||
"Print an error-message and exit."
|
||||
(format *error-output* "~@[~A~%~]~@[~A~%~]" message condition)
|
||||
(format *error-output* "~@[~A~%~]~@[Error: ~A~%~]" message condition)
|
||||
(unix-opts:exit exit-code))
|
||||
|
||||
|
||||
|
|
Ŝarĝante…
Reference in New Issue