aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemsen2013-03-23 16:37:41 +0100
committerGravatar Tom Willemsen2013-03-23 16:37:41 +0100
commitfdce2ed81ca73cc67abffc88615da1ed58b3f502 (patch)
treec6a0caa014e89ec77290fb9e356213f2f32b40fa
parentc7f9d276387028026bfa274e3e6b51e56a9bff5e (diff)
downloadclark-fdce2ed81ca73cc67abffc88615da1ed58b3f502.tar.gz
clark-fdce2ed81ca73cc67abffc88615da1ed58b3f502.zip
Hide command detail
Hide the fact that a command is just of the form NAME-command by abstracting it away into a macro.
-rw-r--r--lisp/clark.lisp8
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/clark.lisp b/lisp/clark.lisp
index ed7743f..e85c5c9 100644
--- a/lisp/clark.lisp
+++ b/lisp/clark.lisp
@@ -30,6 +30,10 @@
(defvar *max-command-name-length* 0
"Lenght of the longest command name.")
+(defmacro call-command (name &rest args)
+ (let ((command-name (make-command-name (symbol-name name))))
+ `(,command-name ,@args)))
+
(defmacro defcommand (name sdoc ldoc &body body)
"Define a new command usable on the command-line."
(let* ((sname (symbol-name name))
@@ -140,7 +144,7 @@ The executable name should already have been removed."
(funcall cmd-name (cdr args))
(progn
(format t "Unknown command: ~A~%" (car args))
- (help-command nil)))))
+ (call-command help nil)))))
(defun print-bookmark (bm)
"Print information about bookmark BM.
@@ -187,7 +191,7 @@ otherwise."
((null ldoc) (format t "Unkown command: ~A~%" (car args)))
((and (symbolp ldoc) (fboundp ldoc)) (funcall ldoc))
(t (format t "~A~%" ldoc))))
- (help-command '("help"))))
+ (call-command help '("help"))))
(defcommand search
"Search through bookmarks."