Yeah, think that'll work (and thanks, I'd have had trouble working that out myself!) - i'll look at that and cliopatra and see which works out best.
On 12 May 2013 13:52, Marc Limotte <[email protected]> wrote: > How about something like this: > > (defn -main [fstr & args] > (let [fsymbol (binding [*read-eval* false] > (read-string fstr))] > (when-not (#{'println 'str 'list} fsymbol) > (throw (Exception. "Invalid function"))) > (apply (eval fsymbol) args))) > > > Marc > > > > On Sun, May 12, 2013 at 5:37 AM, Dick Davies > <[email protected]>wrote: > >> Hi all >> >> I've got a half-decent utility written that i want to provide to our >> ops team (and not let them know it's Clojure based ....ssshhh....). >> >> Works great with 'lein run -m thingy.core/fn1 arg', but there are several >> functions >> I want to expose as 'subcommands' e.g. >> >> java -jar thingy.jar fn1 arg >> >> java -jar thingy.jar fn2 arg1 arg2 >> >> I found tools.cli, but it seems to only really handle command line >> options. >> Is there anything around that works more like the use case above? >> >> worst case I can just have a big (cond ....) , but that seems a bit clumsy >> >> (so far there's more code implementing this feature than the rest of the >> code >> put together, which feels like my Google-fu may have failed me....) >> >> Thanks! >> >> -- >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to [email protected] >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to [email protected] > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
