Skip to content

Commit

Permalink
bugfix: remove acond
Browse files Browse the repository at this point in the history
  • Loading branch information
tani committed Aug 31, 2015
1 parent 539793d commit 3192a29
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions src/ufo.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@
(:export :ufo :setup :dot-ufo :dot-roswell))
(in-package #:ufo)

(defmacro acond (&body pattern)
(let ((b (gensym)))
`(block ,b
,@(loop for p in pattern
for test = (first p)
for body = (rest p)
collect
`(let ((it ,test))
(when it ,@body (return-from ,b)))))))

(defun subcmd-p (subcmd)
(let* ((ros (make-pathname :name subcmd))
(cmd-path (merge-pathnames ros (ufo.util:dot-ufo #p"addon/"))))
Expand All @@ -24,17 +14,16 @@
(ensure-directories-exist (ufo.util:dot-ufo #p"tmp/"))
(let ((addon-dir(merge-pathnames "addon/"(ql:where-is-system :ufo))))
(dolist (addon '("addon-install.ros" "addon-remove.ros"
"install.ros" "remove.ros" "update.ros"
"help.ros"))
"install.ros" "remove.ros" "update.ros" "help.ros"))
(ufo.addon:addon(merge-pathnames addon addon-dir)))))

(defun ufo (subcmd &rest argv)
(setup)
(handler-case
(ufo.util:acond
((subcmd-p subcmd)
(run-program (cons it argv)
:output t :error-output *error-output*))
(t (princ "unkown subcommand") t))
(let ((cmd (subcmd-p subcmd)))
(if cmd
(run-program (cons cmd argv)
:output t :error-output *error-output*)
(progn (princ "unkown subcommand") t)))
(error (e) (princ e) (terpri) t)))

0 comments on commit 3192a29

Please sign in to comment.