You should be able to specify the deps.edn file using a env variable -
The Clojure tools will use the following deps.edn map sources, in this
order:
-
Root - found in the installation of clj (or as a resource in tools.deps)
-
User - cross-project configuration (typically tools)
-
Locations used in this order:
-
If $CLJ_CONFIG is set, then use $CLJ_CONFIG (explicit override)
-
If $XDG_CONFIG_HOME is set, then use $XDG_CONFIG_HOME/clojure
(Freedesktop
conventions)
-
Else use $HOME/.clojure (most common)
-
Project - the deps.edn in the current directory
-
Config data - a deps.edn map passed on the command line
https://clojure.org/reference/deps_and_cli#_deps_edn_sources
Here's an example passing in a map -
clojure -Sdeps '{:deps {myname/mytemplate {:local/root "mytemplate"}}}'
Hope this helps.
On Fri, Oct 9, 2020, 2:26 PM Gregg Reynolds <[email protected]> wrote:
>
>
> On Fri, Oct 9, 2020 at 1:34 PM Gregg Reynolds <[email protected]> wrote:
>
>> I'm writing a command line tool, and using `$ clj -m obazl args` to run
>> it. My deps.edn file contains the path to the sources. Works great,
>> except when it doesn't.
>>
>> I copied the deps.edn to the root directory of a project and when I run
>> it it produces no output. It just returns silently. I injected a bug in
>> the source and it had no effect, so evidently its not even accessing the
>> source.
>>
>> It works in a variety of other contexts (it analyzes some code). I
>> can't see anything different in the directory where it stops working, but
>> there must be something. I deleted .cpcache, no effect. Tried it in a
>> fresh shell to make sure I had not wrecked the env vars; same result, works
>> everywhere but that one directory.
>>
>> What should I be looking for?
>>
>
> Never mind. I was reading a file at initialization time, complete with
> error checking - but used printf to emit the error message and neglected to
> (flush) it.
>
> But the other question stands: how can I pass a deps.edn file to the cli
> command?
>
>
>>
>> Related question: I would like to load deps.edn from a subdirectory,
>> something like `$ clj -d bzl/deps.edn -m obazl args`. The CLI guide says
>> cli takes "Config data - a deps.edn map passed on the command line" -
>> but it does not say how to pass it on the command line. I've tried every
>> way I can think of with no luck.
>>
>> Thanks,
>>
>> Gregg
>>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/clojure/CAO40MimgH2ySee3mOK373PP1OTN7Xdy%2BWFjueYKV3RgZioGGFA%40mail.gmail.com
> <https://groups.google.com/d/msgid/clojure/CAO40MimgH2ySee3mOK373PP1OTN7Xdy%2BWFjueYKV3RgZioGGFA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/clojure/CAHKjGjrnnOjPYhng3%3D9NV782KX1%2BHUgK9DjiJAZfxeyVWYeQmg%40mail.gmail.com.