This repository has been archived on 2019-12-12. You can view files and clone it, but cannot push or open issues/pull-requests.
tildetown-scripts/scripts/mustache.hy

17 lines
397 B
Hy

(import [json [loads]])
(import [sys [argv stdin]])
(import [pystache [render]])
(defn slurp [filename]
(try
(.read (apply open [filename "r"] {"encoding" "utf-8"}))
(catch [e Exception]
"")))
(if (= __name__ "__main__")
(let [[template (-> (get argv 1)
slurp)]
[data (-> (.read stdin)
loads)]]
(print (render template data))))