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.
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 ""}[
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.
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.
Hey @hlship , can you post this as a github issue?
What are you doing checking slack from Hawaii?