Last active
September 20, 2018 15:55
-
-
Save benzap/9a4af8dabd68ded11fcc3eac4b712110 to your computer and use it in GitHub Desktop.
hiccup2xml script written in eden
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/bin/env eden | |
local help-message = " | |
hiccup2xml - Hiccup Markup to XML Markup | |
Usage: | |
hiccup2xml read <filename> | |
hiccup2xml eval <string> | |
" | |
local argv = system.argv | |
if count(argv) == 0 then | |
println(help-message) | |
elseif count(argv) == 2 and argv[0] == "eval" then | |
println(html.stringify(edn.parse(argv[1]))) | |
elseif count(argv) == 2 and argv[0] == "read" then | |
local filename = argv[1] | |
if filesystem.file?(filename) then | |
local s = slurp(filename) | |
println(html.stringify(edn.parse(s))) | |
else | |
println("Given filename does not exist: " filename) | |
end | |
else | |
println(help-message) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment