This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-06-11
Channels
- # aleph (1)
- # aws (4)
- # aws-lambda (5)
- # beginners (85)
- # cider (39)
- # cljs-dev (3)
- # cljsrn (1)
- # clojars (1)
- # clojure (129)
- # clojure-italy (14)
- # clojure-nl (5)
- # clojure-nlp (1)
- # clojure-uk (61)
- # clojurescript (52)
- # cursive (3)
- # datomic (42)
- # duct (3)
- # emacs (9)
- # fulcro (60)
- # graphql (2)
- # juxt (2)
- # keechma (1)
- # leiningen (4)
- # midje (2)
- # off-topic (8)
- # onyx (3)
- # overtone (1)
- # re-frame (22)
- # reagent (51)
- # reitit (3)
- # remote-jobs (3)
- # ring (4)
- # ring-swagger (1)
- # rum (4)
- # shadow-cljs (14)
- # specter (28)
- # tools-deps (85)
- # vim (9)
Is it possible to specify init-opt within deps.edn file?
No, not right now
I think the thing you might be missing is :main-opts is meant to be a list of strings passed as command line arguments, not a list of arbitrary datastructures
Also remember that ,
is whitespace so you can often get around shell-level tokenization by using ,
in strings instead of spaces. But, yeah, :main-opts
are strings @bhauman.
See https://github.com/seancorfield/dot-clojure/blob/master/deps.edn#L33-L37 for example...
to take advantage of the fact that we are in a clojure form to begin with and script our way to euphoria?
But :main-opts
are what is passed as a sequence of strings to the -main
function via clojure.main
-- it's all strings. You can easily pass an EDN string if you want a data structure.
There's no difference between command-line invocation and :main-opts
.
and it is passed by a script, not by Clojure code.
The :main-opts
are cached to a text file and then piped into the (string) options passed to clojure.main
. Just like the :jvm-opts
.
It's just strings in the cached file. And it's just strings that are passed to clojure.main
.
Take a look at the clojure
shell script. Here's an example of what gets cached:
(! 763)-> ls -l .cpcache/*.main
-rw-r--r-- 1 sean staff 90 Mar 26 15:38 .cpcache/1770942858.main
-rw-r--r-- 1 sean staff 17 Apr 14 00:52 .cpcache/2142975460.main
-rw-r--r-- 1 sean staff 17 Apr 14 18:18 .cpcache/4269137912.main
-rw-r--r-- 1 sean staff 22 May 2 14:38 .cpcache/84686696.main
(sean)-(jobs:0)-(~/clojure)
(! 764)-> cat .cpcache/84686696.main
-m rebel-readline.main
(sean)-(jobs:0)-(~/clojure)
(! 765)-> cat .cpcache/1770942858.main
-e (require,'[clojure.tools.nrepl.server,:refer,[start-server]]),(start-server,:port,5555)
(sean)-(jobs:0)-(~/clojure)
(! 766)->
which is parsing main opts and therefore could quote clojure forms before caching them?
I just made a fairly big update to https://github.com/hagmonk/depify/ … would appreciate any folks here who could kick the tires a bit before I post to the mailing list
This includes adding some test runner boilerplate from clj-new.
-- not sure what you mean there @hagmonk?
Should that link to Cognitect's test-runner repo perhaps?
Oh I pinched that from a clj-new generated app - specifically the separate test and runner aliases
I didn’t see the same style being used on the test-runner repo, but maybe I missed it
Ah, I see. Linking to my dot-clojure
repo probably makes more sense then for that https://github.com/seancorfield/dot-clojure/blob/master/deps.edn#L9-L19 (at least by way of explanation).
I’m exploring the idea of adding more aliases to provide parity with project.clj, in those cases where someone has a tools.deps based tool we can use
so now I'm looking at your deps.edn file and getting lots of ideas :) but I need to work on my real projects today at some point, LOL
@bhauman I didn’t understand your earlier comments re quoting. if it’s something I should pay attention to, please try again :)
the ground truth is that the jvm takes a classpath, a main class and string args to the main class. so we want to expose that, first.
other things on top of that may also be useful
but I didn’t understand what problem you were trying to solve or thing you were trying to make better or avoid
it just seems there is an opportunity when providing clojure forms (not strings) inline in :main-opts
to output a single string arg that will make it through to the jvm process as a single arg
the ultimate call needs individual string args though - how do you decide how to parse and tokenize?
you seem to be suggesting a read/print cycle but using different kinds of printing
“-e” would be read as a string and pr’ed as “-e” (perhaps escaped in the invocation as clojure -e '"-e"
`
it seems that string typs can go though untouched and that forms would be dispatched as such
its a common need, and it seems like a shame to be in a clojure form and then have to translate and escape a clojrue form correctly
there are a couple layers of transformation here and I intend to sit down and sort through them methodically. I’m well aware it’s broken in various ways at the moment.
I’m a little concerned about implying evaluation in the deps.edn file
the args there are read (as edn) and never evaluated and I don’t want to imply that (or do it)
it’s important to me that it remains plain edn data
I didn’t think so, but it’s easy to get that impression from that example
I’m not a fan of “special” arg handling
yeah, that’s really same need as say, server repl
passing arbitrary edn as an arg
in a way that is not a nightmare, and that works :)
I’m just saying that a requirement is that the end result works
(as it’s broken now)
there might be a higher level solution to this problem too - I know Rich has mentioned various ideas that are in this ballpark but a somewhat different take on it
for example, you could expose functions directly and hide the main goo entirely
it’s come up in several contexts and I know he’s noodling about it
but sometimes he noodles for many years before it lands somewhere :)
so I make no suggestion that a deux ex machina will save us all here
clojure.main itself is both very flexible and frustratingly limited
like I think it sucks that rebel-readline couldn’t just be hooked directly
well, I need to roll back to other work, but I would like to hear them somewhere :)