This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-05-25
Channels
- # announcements (21)
- # babashka (7)
- # beginners (27)
- # calva (7)
- # chlorine-clover (3)
- # cider (1)
- # clerk (21)
- # clojure (24)
- # clojure-europe (28)
- # clojure-finland (3)
- # clojure-nl (1)
- # clojure-norway (5)
- # clojure-uk (2)
- # clojurescript (13)
- # clr (2)
- # conjure (1)
- # consulting (1)
- # datahike (1)
- # datomic (13)
- # fulcro (3)
- # graalvm (33)
- # gratitude (7)
- # honeysql (7)
- # humbleui (12)
- # hyperfiddle (26)
- # interop (11)
- # introduce-yourself (4)
- # jobs-discuss (8)
- # lsp (26)
- # malli (6)
- # nbb (11)
- # polylith (26)
- # practicalli (1)
- # rdf (3)
- # re-frame (7)
- # reitit (10)
- # releases (2)
- # shadow-cljs (1)
- # tools-deps (15)
Is there a similar feature in Clojure CLI to Leiningen :injections
? I'm using clj -e
but I'm wondering if init-opt can be achievable from deps.edn
-e
can be put in :main-opts
in deps.edn
but the specifics depend on exactly what you already have...
Is this just to start a REPL?
(~/clojure/repl)-(!2009)-> cat deps.edn
{:aliases
{:repl
{:main-opts ["-e" "(ns foo.bar)" "-r"]}}}
Thu May 25 14:09:54
(~/clojure/repl)-(!2010)-> clj -M:repl
foo.bar=>
☝️:skin-tone-2: does that help?Actually is a curiosity based on how githooks works, since we need to manually run git config core.hooksPath dir
I can solve this on leiningen projects adding an injection like :injections [(require '[clojure.java.shell :refer [sh]]) (sh ....)]
I'm assuming that any lein anything
I run will setup githooks for me. So adding this to a specific alias may not solve 100%
Maybe adding as injections is not the best solution but I always try to "translate" from leiningen to clojure cli what I'm doing
With the CLI, you need an alias for this, or supply it on the command line. But you may be better off writing build.clj
for the tasks you want to do since then you can run commands easily and compose things since "it's just code".
I don't really understand your use case tho' -- you only need to run git config
once for a given project, yes?
Yes, was just an idea to avoid manually doing this each time you download and be part of an “invisible” process
I think using makefile is better for this also, is just a brainstorming
If you're interacting with git
, I'd definitely suggest looking at tools.build
since it has git
functionality in its API. And then just do stuff via clojure -T:build <something>
(like lein <something>
) and it can do whatever you need...
We have pretty much all our dev/test/CI tooling built around tools.build
and build.clj
at work -- and I use that approach with most of my OSS projects on GitHub too.
if it’s just once you could do something like
clj -X:dev dev/install-git-hooks
and code it up yourself
Yes, both solutions seems better by adding to a makefile.
Another use case I remembered was a project using midje, when we executed eastwood and kibit the tests were running, since they load the files. The way to avoid this (don't know if it's the best solution either) was an injection :injections [(require 'clojure.test) (alter-var-root #'clojure.test/*load-tests* (constantly false))]
in a linter profile, this could be 100% achievable with an alias on Clojure CLI.
The difference is that leiningen allows an injection on the defproject root, which may solve some better use cases than the ones I'm bringing here 😅
But thanks! I've learned a little more about clj cli with this conversation