This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-01
Channels
- # babashka (1)
- # beginners (28)
- # calva (28)
- # cider (8)
- # clj-kondo (1)
- # clojars (4)
- # clojure (20)
- # clojure-australia (1)
- # clojure-europe (13)
- # clojure-uk (2)
- # clojurescript (2)
- # conjure (4)
- # core-async (4)
- # cryogen (3)
- # datomic (17)
- # fulcro (3)
- # helix (45)
- # malli (9)
- # off-topic (6)
- # pathom (3)
- # re-frame (13)
- # reitit (17)
- # sci (1)
- # shadow-cljs (9)
- # sql (6)
- # tools-deps (11)
- # vim (17)
Hello! I am sorry, I obviously am not good enough in reading docs. What do I need to do to be able to run my project with just clj -X
without arguments? I have tried
{:deps {...}
:exec-fn clj-tumblr-summarizer.main/-main}
but that complains "No function found on command line or in :exec-fn"
(https://clojure.org/guides/deps_and_cli#_using_a_main does not mention how to hardcode the function. I have also tried https://clojure.org/reference/deps_and_cli#_running_a_main_or_script and add :main-opts ["-m" "clj-tumblr-summarizer.main/-main"]
)You need to define an alias to use with the -X
flag.
My understanding is the -X
flag should be used with an alias, as I havent seen any examples of using :exec-fn as a top level key. From the error you are getting, this seems to be a correct...
There are plenty of examples of :exec-fn
, :exec-args
and :ns-default
in the practicalli/clojure-deps-edn
https://github.com/practicalli/clojure-deps-edn
You can specify :exec-fn
on the command line I believe, if you really dont want an alias
Edit: hmm, I am not sure that is right now. You can specify a function, but still has to be with an alias.
Edit: as borkdues says below, if its a fully qualified function on the class path, then the command line is enough - need to add some good examples to the book so I dont forget
You can't run just clj -X
on its own. You either have to provide an alias or you have to specify the function to call on the command-line.
Just like :main-opts
can't be at the top level in deps.edn
, :exec-fn
, :exec-args
, :ns-default
, etc all need to be under an alias.
There are only a few keys valid at the top level @U0522TWDA
:deps - map of lib (symbol) to coordinate
:paths - vector of paths
:aliases - map of alias name to alias data
provider-specific keys for configuring dependency sources
(that last one is stuff like :mvn/repos
)See https://clojure.org/reference/deps_and_cli#_operation (just after the link you already posted).
Thanks a lot!