Fork me on GitHub
#planck
<
2018-04-11
>
owenrh20:04:56

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)

owenrh20:04:45

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

owenrh20:04:20

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

owenrh20:04:21

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

mfikes20:04:25

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

mfikes20:04:00

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

mfikes20:04:57

I also get

$ ./foo.cljs ClojureScript
Hello ClojureScript!

owenrh20:04:43

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

mfikes20:04:48

This is on macOS

owenrh20:04:49

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!

owenrh20:04:07

it’s brill by the way 👍

owenrh20:04:15

thanks for creating and sharing it

mfikes20:04:16

Ahh, cool 🙂