0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 23:49:45 -05:00

🎉 Add srepl helpers for run and print available tasks

This commit is contained in:
Andrey Antukh 2022-08-11 16:23:42 +02:00
parent ada0938e27
commit 7626d912b9

View file

@ -9,7 +9,24 @@
#_:clj-kondo/ignore
(:require
[app.common.logging :as l]
[app.common.pprint :as p]
[app.srepl.fixes :as f]
[app.srepl.helpers :as h]
[app.srepl.fixes :as f]))
[clojure.pprint :refer [pprint]]))
;; Empty namespace as main entry point for Server REPL
(defn print-available-tasks
[system]
(let [tasks (:app.worker/registry system)]
(p/pprint (keys tasks) :level 200)))
(defn run-task!
([system name]
(run-task! system name {}))
([system name params]
(let [tasks (:app.worker/registry system)]
(if-let [task-fn (get tasks name)]
(task-fn params)
(l/warn :hint "no task found" :name name)))))