David Krentzlin avatar David Krentzlin committed b109dc8 Draft

reverted to old processor until i have time to integrate the changes

Comments (0)

Files changed (1)

mira.core/src/processor.lisp

   (gethash (sring-downcase (string name)) collection))
 
 ;;
-;; (defcommand <processor-echo> 0 (echo (content &key (foo  1))
+;; (defcommand processor 0 (echo (content &key (foo  1))
 ;;                           (do-sth-with content)))))
 
-;; (defusage <processor-echo> echo
+;; (defusage processor echo
 ;;   :banner "echo content"
 ;;   (foo :required "Sets the frooble")
 ;;   (bar :optional "Set the barble")
     `(labels ((,closure (lambda (&rest arguments)
                           (destructuring-bind (,@command-lambda-list) arguments
                             ,@body))))
-       (defmethod initialize-instance :after ((processor  ,proc) &rest args)
-         (declare (ignore args))
-         (add-command processor
-                      (string ',command-name)
-                      (make-instance '<command>
-                                     :required-access-level ,level
-                                     :body ,closure))))))
+       (add-command ,proc
+                    (string ',command-name)
+                    (make-instance '<command>
+                                   :required-access-level ,level
+                                   :body ,closure)))))
 
 @export
 (defmacro defusage (processor command-name banner &rest options)
-  `(defmethod add-command :after ((processor ,processor) cmd-name cmd)
-     (when (equal? (string ',command-name) (string cmd-name))
-       (with-slots (usage help) ,cmd
-         (setf usage banner)
-         (setf help (generate-help
-                     (string ',command-name)
-                     banner
-                     '(,@options)))))))
+  `(with-slots (usage help) ,processor
+     (setf usage banner)
+     (setf help (generate-help
+                 (string ',command-name)
+                 banner
+                 '(,@options)))))
 
 (defun command-syntax? (input self-ident)
   (cl-ppcre:scan (format nil "^~A:? +~A(.+?)"
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.