Fork me on GitHub
#calva
<
2022-04-25
>
pinkfrog13:04:09

How can I sepcify different comands for jackin. Currently for shadow it is:

npx shadow-cljs -d cider/cider-nrepl:0.27.4 watch :app
I’d like it to be
npx shadow-cljs -d cider/cider-nrepl:0.27.4 watch :app <some-args>
Along with this doc, I thought the original command might come from https://github.com/BetterThanTomorrow/calva/blob/published/src/nrepl/connectSequence.ts#L1 but I didn’t find the word watch.

pez14:04:48

There is no way to do this with jack-in currently. You will have to use connect.

pez14:04:24

Please file an issue about it.

pez15:04:29

<!subteam^S03BGSAUPTQ|@calva-team> since we are building a command line as an array which we then execute. Maybe a way to solve this more general case is to make the command line array itself configurable? That would then be used instead of Calva building it. We could have some place-holder variables for the dependencies. So in the case above, the user would use a custom connect sequence with something like so in it:

"jack-in-command-line": ["npx", "shadow-cljs", "-d", "$CIDER-NREPL-VERSION", "watch", ":app", "some-arg-1", "some-arg-2"]
It would become a bit tricky to construct the command line for Leiningen and deps.edn this way, but we could make a convenience command for copying out the jack-in command as an array, to start off with. The user can then also specify a custom script:
"jack-in-command-line": ["start-my-repl.sh", "$CIDER-NREPL-VERSION"]
And if we execute the command with some environment variables for the dependencies and middlewares, the user can use those in their script and the command-line would be only:
"jack-in-command-line": ["start-my-repl.sh"]
In combination with the current ways to provide jackInEnv, this should provide a lot of flexibility, I think.

1
Cora (she/her)15:04:21

maybe prefix the env vars with CALVA_

1
Cora (she/her)15:04:01

but otherwise that sounds good to me

Cora (she/her)15:04:23

I like escape hatches like that that give you total control

1
pez15:04:26

Yes, those vars should be properly prefixed of course. $CIDER-NREPL-VERSION above is not an env var, just to clarify.

Cora (she/her)15:04:35

oh absolutely, but even in that case prefixes prevent possible overlap, like namespacing keys

Cora (she/her)15:04:14

I really like this idea. it was forever a pain in emacs that it wasn't simple to override these things

pez15:04:27

Not sure I follow, please elaborate some.

pez15:04:10

To have developers as the end users does provide room for some solutions that would be a bit crazy otherwise. 😃

😆 1
bringe15:04:17

I like the idea as well

metal 2
Cora (she/her)15:04:43

I mean with the variables we'll interpolate into their command array it still pays to prefix with CALVA since it's possible that any other value could be a legitimate value they don't want interpolated

pez15:04:44

I assumed we couldn't get variables in the array interpolated by the shell. You think we can? Then we don't need to interpolate at all. Just execute with env vars and the user can use them either in the array or inside some script.

Cora (she/her)15:04:18

no, I meant outside the shell

rayat16:04:29

No harm in namespacing i feel like