joker 2020-02-18

@simen.oya has joined the channel

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

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...

👍 1

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)
...

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

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

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

👍 1

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

I'll do that

👍 1

@mpenet has left the channel

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?

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?

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