joker

Discuss all things joker, the Clojure interpreter/linter on top of Go. https://github.com/candid82/joker
2019-03-19T00:51:20.017400Z

Hi there -- much thanks for Joker... this is a pretty cool tool for both linting and scripting.

2019-03-19T00:52:14.018500Z

I have a use-case where I want to pass off the stdin tty to a sub process -- e.g. effectively call "exec" and never return to my process. Is there a way of doing this, or perhaps an easy path where I could add it?

2019-03-19T00:54:10.018800Z

Would implementing os/exec be the right path forward?

👍 1
2019-03-19T15:07:59.019800Z

Ok great -- much thanks. If there's some way I can help let me know. I did find a way around this issue (outside of joker) but this use case would still be helpful to me in the future.

Candid 2019-03-20T03:51:43.029300Z

https://candid82.github.io/joker/joker.os.html#exec

2019-03-20T16:14:05.031700Z

Very awesome -- much thanks!

Candid 2019-03-19T05:56:19.019600Z

well, joker.os/sh is already implemented using os/exec facilities, it just doesn't support passing stdin. I'll look into it. I am thinking it should be a more generic version of joker.os/sh. Something like (joker.os/exec name opts), where opts can have :dir, :args and :stdin keys.

richiardiandrea 2019-03-19T18:03:31.020700Z

Hello folks! I am trying to send an http call but I get:

user=> (require '[joker.http :as http])
<joker.core>:3355:3: Eval error: open /home/arichiardi/joker/http.joke: no such file or directory
Stacktrace:
  global <repl>:4:1
  joker.core/require <joker.core>:3332:3
  joker.core/apply <joker.core>:508:4
  joker.core/apply__ <joker.core>:3252:9
  joker.core/apply <joker.core>:508:4
  joker.core/apply__ <joker.core>:3211:5
  joker.core/with-bindings* <joker.core>:1381:7
  joker.core/apply <joker.core>:506:4
  joker.core/apply__ <joker.core>:3214:11
  load <joker.core>:3170:3
  joker.core/load <joker.core>:3367:9
  joker.core/with-bindings* <joker.core>:1381:7
  joker.core/apply <joker.core>:506:4
  joker.core/apply__ <joker.core>:3371:13
  joker.core/load-file <joker.core>:3355:3
Am I missing some configuration?

richiardiandrea 2019-03-19T18:03:42.021Z

I installed it with nix-env -i joker

richiardiandrea 2019-03-19T18:06:36.022200Z

ok it seems like working with the latest standalone executable

jcburley 2019-03-19T18:06:39.022400Z

Looks like nix-env installs a fairly old version of Joker; if that doesn't have joker.http, you'd likely see the same behavior. Try building Joker yourself as described on the main Joker github page.

jcburley 2019-03-19T18:06:43.022600Z

Ah, yes.

richiardiandrea 2019-03-19T18:06:52.022800Z

cool thanks!

richiardiandrea 2019-03-19T18:08:43.023Z

works like a charm! 😄

👍 1
richiardiandrea 2019-03-19T18:10:24.024100Z

a question I have is, how do you folks distribute joker scripts? say for running on CI, do you clone the whatever repo and just joker filename.joke?

jcburley 2019-03-19T18:14:18.025Z

I hand-install joker to /usr/bin and have my *.joke scripts start off with #!/usr/bin/env joker, but that's just me cobbling together stuff for now.

richiardiandrea 2019-03-19T18:14:51.025300Z

yeah I was thinking about doing that as well...

richiardiandrea 2019-03-19T18:15:48.025600Z

ok sorry another lil' error I am getting

richiardiandrea 2019-03-19T18:15:52.025800Z

$ joker src/cd/assert_environment.cljs 
<joker.core>:3474:13: Eval error: open /home/arichiardi/git/laputa/continuous-delivery/src/clojure/string.joke: no such file or directory
Stacktrace:
  global src/cd/assert_environment.cljs:1:1
  core/require <joker.core>:3423:3
  core/apply <joker.core>:521:4
  core/apply__ <joker.core>:3340:9
  core/apply <joker.core>:521:4
  core/apply__ <joker.core>:3293:5
  core/with-bindings* <joker.core>:1400:7
  core/apply <joker.core>:519:4
  core/apply__ <joker.core>:3296:11
  load <joker.core>:3236:3
  core/load <joker.core>:3470:9
  core/with-bindings* <joker.core>:1400:7
  core/apply <joker.core>:519:4
  core/apply__ <joker.core>:3474:13

richiardiandrea 2019-03-19T18:16:04.026100Z

this file contains (:require [clojure.string :as string])

richiardiandrea 2019-03-19T18:16:09.026300Z

and a couple of defs

richiardiandrea 2019-03-19T18:16:45.026700Z

probably I need to set the classpath or something?

jcburley 2019-03-19T18:20:15.028400Z

There's no clojure.string in Joker; just joker.string. Joker still has a rather small library of packages in and of itself. There's an undocumented --classpath (or -c) option, I think it is, that we added recently, so it can search for other libraries instead of just assuming they're somewhere in the current working directory.

richiardiandrea 2019-03-19T18:20:47.028900Z

oh got it, so I would need to change my scripts ... cool thank you!

👍 1