planck

Planck ClojureScript REPL
owenrh 2018-04-11T20:15:56.000359Z

hi, I’m trying out the main function method from the scripts page on the Planck user guide, http://planck-repl.org/scripts.html, but I’m not getting any output. It just doesn’t seem to pick up the main function var

#!/usr/bin/env planck
(ns foo.core)

(defn greet [name]
  (println (str "Hello " name "!")))

(defn -main [name]
  (greet name))
  
(set! *main-cli-fn* -main)

owenrh 2018-04-11T20:16:45.000262Z

I’m on OSX. Installed Planck via brew. I run zsh, not sure if that is interfering somehow.

owenrh 2018-04-11T20:17:20.000139Z

Does anyone have any ideas why this wouldn’t have worked?

owenrh 2018-04-11T20:19:21.000254Z

Also, it doesn’t seem to resolve the commandline args either - WARNING: Use of undeclared Var bar.core/*command-line-args*

mfikes 2018-04-11T20:19:25.000492Z

$ /usr/local/bin/planck foo.cljs Testing
Hello Testing!

mfikes 2018-04-11T20:20:00.000530Z

That’s what I get @owenrh ^ if I put your code in a file and run it.

mfikes 2018-04-11T20:20:57.000076Z

I also get

$ ./foo.cljs ClojureScript
Hello ClojureScript!

owenrh 2018-04-11T20:21:43.000529Z

that’s what I figured, defo something in my environment

mfikes 2018-04-11T20:21:48.000264Z

This is on macOS

owenrh 2018-04-11T20:22:49.000388Z

ah yeah, I’ve got two machines - this one had an old version of Planck on from back in the day from when I first thought about checking it out. Sorry for the noise!

owenrh 2018-04-11T20:23:07.000103Z

it’s brill by the way 👍

owenrh 2018-04-11T20:23:15.000467Z

thanks for creating and sharing it

mfikes 2018-04-11T20:23:16.000603Z

Ahh, cool 🙂