This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-25
Channels
- # babashka (9)
- # beginners (56)
- # calva (18)
- # clj-kondo (2)
- # clojars (2)
- # clojure (46)
- # clojure-boston (1)
- # clojure-europe (4)
- # clojurescript (10)
- # css (1)
- # data-science (2)
- # emacs (10)
- # girouette (1)
- # helix (10)
- # jobs-discuss (4)
- # malli (2)
- # off-topic (28)
- # polylith (5)
- # re-frame (4)
- # reitit (8)
- # releases (6)
- # rewrite-clj (1)
- # sci (44)
- # sql (10)
- # tools-deps (31)
I’m converting a project to use bb tasks
. Loving it! I have the following bb task scenario:
;; script/create-file.clj
(defn -main [& args]
(do-stuff args))
;; bb.edn
{:init (defn get-app-config
[]
(io/resource "config.edn"))
:tasks
{;; option 1
the-task create-file}
;; option 2
the-task (shell "bb create-file" (get-app-config))}
get-app-config
is going to read an edn
config file (aero) and pass it to create-file
. “option 2” works, but I was curious if its possible to pass in args to option 1 where the value of the-task
is just a symbol. Or maybe there is a more recommended approach for this idea? Example:
;; option 1
the-task (create-file (get-app-config))}
Thanks!what you can do there is:
:tasks
{-the-config (get-app-config)
the-task {
:depends [-the-config]
:requires ([create-file])
:task (create-file/do-stuff -the-config)}}
for exampleby depending on -the-config
, that will be executed first and then you can pass on that value to another function from another namespace
note that your filename has to use underscores script/create_file.clj
, same as with clojure files in clojure on the classpath
👍 3
oh, that is very nice!
Thanks!!