github command interface has been added to john titor
This commit is contained in:
parent
79b6ffeca1
commit
d90c2ee044
|
@ -0,0 +1,16 @@
|
|||
(ns john-titor.commands.github
|
||||
(:require
|
||||
[john-titor.github :as github]
|
||||
[john-titor.utils :as u]
|
||||
[john-titor.commands.protocols :as proto :refer [defcommand]]))
|
||||
|
||||
(deftype GithubCommandRouter []
|
||||
proto/CommandRouter
|
||||
(init [_ server]
|
||||
(defcommand server
|
||||
"github-notifications"
|
||||
#(u/on-value (github/notification-command %)))))
|
||||
|
||||
(comment
|
||||
(u/on-value (github/notification-command [])
|
||||
#(println %)))
|
|
@ -0,0 +1,8 @@
|
|||
(ns john-titor.github
|
||||
(:require
|
||||
[john-titor.github.core :as g]))
|
||||
|
||||
|
||||
(defn notification-command
|
||||
[args]
|
||||
(g/notifications))
|
|
@ -41,14 +41,16 @@
|
|||
([]
|
||||
(notifications {}))
|
||||
([opts]
|
||||
(api-get "/notifications" {})))
|
||||
(api-get "/notifications" {})
|
||||
(go `(message "hello"))))
|
||||
|
||||
|
||||
(process-response (fn [res]
|
||||
(println (doseq [x (:body res)]
|
||||
(println (str (:name (:repository x))
|
||||
" "
|
||||
;;(:title (:subject x))
|
||||
" "
|
||||
(:reason x))))))
|
||||
(notifications))
|
||||
(comment
|
||||
(notifications)
|
||||
(process-response (fn [res]
|
||||
(println (doseq [x (:body res)]
|
||||
(println (str (:name (:repository x))
|
||||
" "
|
||||
;;(:title (:subject x))
|
||||
" "
|
||||
(:reason x))))))
|
||||
(notifications)))
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
(ns john-titor.utils
|
||||
(:require
|
||||
[clojure.core.async :refer [take!]]))
|
||||
[clojure.core.async :refer [take! <!!]]))
|
||||
|
||||
(defn wait-for
|
||||
(defn on-value
|
||||
[ch]
|
||||
(take! ch))
|
||||
(<!! ch))
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
(defun john_titor/connect ()
|
||||
"Connect to john titor via RPC."
|
||||
(setq epc-connection
|
||||
(epc:start-epc "node" '("../../../john_titor/target/main.js"))))
|
||||
(if debug-on-error
|
||||
(epc:start-epc "node" '("../../../john_titor/target/main.js"))
|
||||
(epc:start-epc "node" '("../../../john_titor/app.js")))))
|
||||
|
||||
(defun john_titor/call-sync (command args)
|
||||
"Call the given COMMAND with the given ARGS via john titor epc."
|
||||
|
|
Loading…
Reference in New Issue