This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-08-12
Channels
- # aleph (3)
- # announcements (15)
- # architecture (6)
- # babashka (35)
- # babashka-sci-dev (10)
- # biff (5)
- # calva (9)
- # cherry (1)
- # cider (44)
- # clj-kondo (31)
- # cljfx (1)
- # clojure (108)
- # clojure-europe (32)
- # clojure-norway (12)
- # clojurescript (15)
- # conjure (3)
- # cursive (8)
- # datahike (1)
- # datalevin (19)
- # datascript (1)
- # datomic (59)
- # emacs (4)
- # graphql (3)
- # jobs (1)
- # luminus (6)
- # meander (9)
- # membrane (45)
- # nbb (67)
- # off-topic (16)
- # portal (3)
- # remote-jobs (1)
- # scittle (8)
- # shadow-cljs (46)
- # test-check (7)
- # tools-deps (5)
- # vim (63)
- # web-security (11)
- # xtdb (15)
Is there a way to reference an alias that includes a :main-opts
but does not actually call the -main
when referenced? Similar to how you can use -X
with an alias that includes an exec-fn
but include it with -A
and it won't call the function. Example in thread 🧵
% cat deps.edn
{:aliases
{:main {:extra-paths ["src"]
:main-opts ["-m" "com.grzm.ex.main"]
:exec-fn com.grzm.ex.main/exec}
:exec {:extra-paths ["src"]
:exec-fn com.grzm.ex.main/exec}}}
% cat src/com/grzm/ex/main.clj
(ns com.grzm.ex.main)
(defn exec [_]
(println "Hello, exec!"))
(defn -main [& _args]
(println "Hello, main!"))
% clj -X:exec
Hello, exec!
Called exec-fn
% clj -A:exec
Clojure 1.10.3
user=>
Opened a repl with the appropriate classpath. Didn’t call exec-fn
.
% clj -M:main
Hello, main!
Called -main
.
% clj -A:main
WARNING: Use of :main-opts with -A is deprecated. Use -M instead.
Hello, main!
I’d like this last to open a repl, rather than call the -main
Is there an alternative incantation that would do this that I’m missing?No, separate into two aliases
Cool. Thanks, @U064X3EF3!