Print to *error-output* when an error occurs

This commit is contained in:
Tom Willemsen 2013-03-27 21:38:15 +01:00
parent 30acc48afd
commit ac7d882292

View file

@ -50,13 +50,15 @@
(num-args (length args))) (num-args (length args)))
(cond (cond
((< num-args min-args) ((< num-args min-args)
(format t "Too few arguments, need at least ~D, got ~D~%" (let ((*standard-output* *error-output*))
min-args num-args) (format t "Too few arguments, need at least ~D, got ~D~%"
(call-command help ,sname)) min-args num-args)
(call-command help ,sname)))
((and max-args (> num-args max-args)) ((and max-args (> num-args max-args))
(format t "Too many arguments, need at most ~D, got ~D~%" (let ((*standard-output* *error-output*))
max-args num-args) (format t "Too many arguments, need at most ~D, got ~D~%"
(call-command help ,sname)) max-args num-args)
(call-command help ,sname)))
(t ,@body)))) (t ,@body))))
(setf *help-messages* (setf *help-messages*
(nconc *help-messages* '((,sname ,sdoc ,ldoc))) (nconc *help-messages* '((,sname ,sdoc ,ldoc)))
@ -187,7 +189,7 @@ The executable name should already have been removed."
(let ((cmd-name (make-command-name (car args)))) (let ((cmd-name (make-command-name (car args))))
(if (fboundp cmd-name) (if (fboundp cmd-name)
(funcall cmd-name (cdr args)) (funcall cmd-name (cdr args))
(progn (let ((*standard-output* *error-output*))
(format t "Unknown command: ~A~%" (car args)) (format t "Unknown command: ~A~%" (car args))
(call-command help)))) (call-command help))))
(map nil #'print-bookmark (get-bookmarks)))) (map nil #'print-bookmark (get-bookmarks))))