diff --git a/tools/karun.nim b/tools/karun.nim index 320802f..a7ba3c0 100644 --- a/tools/karun.nim +++ b/tools/karun.nim @@ -4,13 +4,16 @@ import os, strutils, parseopt, browsers const + css = """ + + +""" html = """ $1 - - + $2
@@ -28,13 +31,18 @@ proc main = var rest = op.cmdLineRest var file = "" var run = false + var selectedCss = "" while true: op.next() case op.kind of cmdLongOption: - if op.key == "run": + case op.key + of "run": run = true rest = rest.replace("--run ") + of "css": + selectedCss = css + else: discard of cmdShortOption: if op.key == "r": run = true @@ -47,7 +55,7 @@ proc main = createDir("nimcache") exec("nim js --out:nimcache/" & name & ".js " & rest) let dest = "nimcache" / name & ".html" - writeFile(dest, html % name) + writeFile(dest, html % [name, css]) if run: openDefaultBrowser(dest) main()