Fork me on GitHub
#joker
<
2020-02-18
>
dxlr8r11:02:20

new to joker, wonder how entry points works.

(ns k3os.foo)

(defn -main [](println "entry point?"))
(defn main- [](println "entry point?"))
(defn main  [](println "entry point?"))
And when I run it: $ joker foo.joke I get no output

gleisonsilva14:02:55

I think you'll be better off just calling (println "...") on the bottom of your script... What I've done a lot is using joker.tools.cli to parse the arguments and then calling the right function...

👍 4
jcburley14:02:25

Yes, Joker, like most Lisps AFAIK, just executes code like a script. So if you want to invoke a main-style function you've defined... ...just do that:

user> (main)
...

dxlr8r14:02:37

calling main from the script leads to issues with unit testing etc.

jcburley14:02:11

Look into *main-file* and *file* then. E.g. compare them to determine whether running the script directly or within a unit test.

dxlr8r14:02:09

for now that seems to be an option. But ideally, joker should use the clojure standard of -main IMHO

👍 4
jcburley14:02:03

Please Issue that then! Might be nice to have....

dxlr8r14:02:11

I'll do that

👍 4
gleisonsilva14:02:01

Hey guys! I'm trying to find a practical way to parse some XML files using Joker inside a script that I already have... Some ideas?

jcburley14:02:25

Yes, Joker, like most Lisps AFAIK, just executes code like a script. So if you want to invoke a main-style function you've defined... ...just do that:

user> (main)
...

jcburley14:02:11

Look into *main-file* and *file* then. E.g. compare them to determine whether running the script directly or within a unit test.

gleisonsilva14:02:54

Joker has an implementation of xml-seq... all references that I found for this fn use it with clojure.data.xml or clojure.xml where there is a parse fn... but has Joker a function like that? If not, how should this fn xml-seq be used?

Candid05:02:17

xml-seq doesn't actually parse XML. Joker currently doesn't have XML parsing functionality.