diff options
-rw-r--r-- | l/src/main.lisp | 10 | ||||
-rw-r--r-- | l/src/option.lisp | 5 |
2 files changed, 14 insertions, 1 deletions
diff --git a/l/src/main.lisp b/l/src/main.lisp index 99a60d0..9701d5f 100644 --- a/l/src/main.lisp +++ b/l/src/main.lisp @@ -20,7 +20,15 @@ :long "version")) (defun main () - (multiple-value-bind (options free-args) (opts:get-opts) + (multiple-value-bind (options free-args) + (handler-bind + ((opts:unknown-option #'handle-option-error) + (opts:missing-arg #'handle-option-error) + (opts:arg-parser-failed #'handle-option-error) + (opts:missing-required-option #'handle-option-error)) + + (opts:get-opts)) + (when-option (options :help) (opts:describe :usage-of "extreload" diff --git a/l/src/option.lisp b/l/src/option.lisp index d828230..11f7f98 100644 --- a/l/src/option.lisp +++ b/l/src/option.lisp @@ -4,3 +4,8 @@ `(let ((value (getf ,options ,option))) (when value ,@body))) + +(defun handle-option-error (condition) + (format *error-output* "error: ~a~%" condition) + + (opts:exit 64)) |