Permalink
Browse files

update commands

  • Loading branch information...
1 parent 4f2f141 commit 5e7f4d947ce32705c752e47180ba3c8ecec942f3 @duck1123 duck1123 committed Aug 8, 2012
Showing with 9 additions and 5 deletions.
  1. +9 −5 src/ciste/commands.clj
View
@@ -30,22 +30,22 @@
(defn parse-command
"Takes a sequence of key/value pairs and runs a command"
[{:as command}]
- (log/info "parsing command")
(let [{:keys [name args]} command]
+ (log/infof "parsing command: %s %s" name (pr-str args))
((->> @*commands*
(map (fn [[k v]] [{:name k} {:action v}]))
(resolve-routes @*command-predicates*))
- (merge command
- {:format :text
- :serialization :command}))))
+ (merge {:format :text
+ :serialization :command}
+ command))))
;; Should this return a set?
(defn command-names
"The names of all the registered commands."
[]
(sort (keys @*commands*)))
-(add-command! "commands-list" #'command-names)
+(add-command! "list-commands" #'command-names)
(deffilter #'command-names :command
[action request]
@@ -55,3 +55,7 @@
[request names]
(string/join "\n" names))
+(defview #'command-names :json
+ [request names]
+ {:body names})
+

0 comments on commit 5e7f4d9

Please sign in to comment.