joker

Discuss all things joker, the Clojure interpreter/linter on top of Go. https://github.com/candid82/joker
hlship 2021-03-31T23:24:41.007200Z

I'm working on a tool to automate part of data retrieval for me; currently the tool downloads JSON data and optionally pipes it through gron (https://github.com/TomNomNom/gron). That works fine, but I want to then optionally pump the gron output through fzf (https://github.com/junegunn/fzf). Whether using joker.os/sh or joker.os/exec, fzf fails to operate correctly since its stdin is not connected to the terminal directly since Joker is running. I'm wondering if there's a way to make this work in current Joker, or with some future Joker with new os functions -- I think to get the behavior I want, I need to have something like joker.os/sh spawn a new process to replace the current Joker process -- or at least, directly connect the new process'es stdin to stdin when Joker was started, if you follow me.

hlship 2021-03-31T23:26:29.008800Z

E.g.,

joker -e '(joker.os/sh "sh" "-c" "ls -l | fzf")'
executes, but fzf runs blind.  You can use the arrow keys to move an invisible cursor, and the tab key to select lines, and enter to exit fzf, but you don't get to see any visual feedback:
~/workspaces/walmart/cph-tools > joker -e '(joker.os/sh "sh" "-c" "ls -l | fzf")'
{:success true, :exit 0, :out "-rw-r--r--  1 hship  staff  4112 Mar 31 15:49 common.joke\n", :err ""}[

hlship 2021-03-31T23:28:41.010200Z

I'd propose a new function, launch, that might look like: (joker.os/launch "ls -l | fzf") This functiton would launch the new process, properly pipe in stdin to it (from the terminal), so fzf could run as if executed directly from the shell, and return the standard output from fzf.

hlship 2021-03-31T23:50:07.012Z

Perhaps there's an option where the Joker process doesn't have to exit, and can return a proc map as with joker.os/exec. But the main thing is. it would be useful to be able to create and execute shell pipelines, including those that involve terminal I/O, as or more easily as from bash.

Candid 2021-04-01T17:20:47.017900Z

Hey @hlship , can you post this as a github issue?

hlship 2021-04-01T17:57:21.018200Z

What are you doing checking slack from Hawaii?

hlship 2021-04-01T19:03:36.018400Z

https://github.com/candid82/joker/issues/461