Files
kiss-vscode/projects/file-watch/src/Main.kiss

19 lines
656 B
Plaintext

(defun check [file delay command erase]
(let [contents
(try
(StringTools.trim (File.getContent file))
(catch [e] ""))]
(if (< 0 contents.length)
#|for (line in contents.split("\n")) {
new Process(StringTools.replace(command, "{}", '"' + line + '"'));
}|#))
(if erase (File.saveContent file ""))
(Sys.sleep delay)
(check file delay command erase))
(defun :Void main []
(check
(nth (Sys.args) 0)
(Std.parseFloat (nth (Sys.args) 1))
(nth (Sys.args) 2)
(= 1 (Std.parseInt (nth (Sys.args) 3)))))