Last active
August 18, 2017 23:45
-
-
Save rplevy/ac6cd78eda101b7e4ace56ffc5b25273 to your computer and use it in GitHub Desktop.
elisp wrapper on cljs script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun xml->clj-region (beg end) | |
(interactive "r") | |
(shell-command-on-region beg end | |
"xmlclj" | |
(current-buffer) | |
t)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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