Skip to content

Instantly share code, notes, and snippets.

@rplevy
Last active August 18, 2017 23:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rplevy/ac6cd78eda101b7e4ace56ffc5b25273 to your computer and use it in GitHub Desktop.
Save rplevy/ac6cd78eda101b7e4ace56ffc5b25273 to your computer and use it in GitHub Desktop.
elisp wrapper on cljs script
(defun xml->clj-region (beg end)
(interactive "r")
(shell-command-on-region beg end
"xmlclj"
(current-buffer)
t))
#!/usr/local/bin/planck -D funcool/tubax:0.2.0
(ns scripts.xmlclj
(:require [tubax.core :as tubax]
[planck.core :refer [slurp *command-line-args* *in* line-seq]]
[cljs.pprint :refer [pprint]]))
(defn last-4-chars [s]
(apply str (reverse (take 4 (reverse s)))))
(let [s (first *command-line-args*)
xml (if (= ".xml" (last-4-chars s))
(slurp s)
(or s
(apply str (vec (line-seq *in*)))))]
(pprint (tubax/xml->clj xml)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment