This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-12-30
Channels
- # adventofcode (1)
- # announcements (1)
- # babashka (5)
- # beginners (344)
- # bristol-clojurians (1)
- # calva (18)
- # cljfx (6)
- # clojure (85)
- # clojure-europe (37)
- # clojure-finland (1)
- # clojure-france (2)
- # clojure-nl (2)
- # clojure-taiwan (3)
- # clojure-uk (17)
- # clojurescript (13)
- # conjure (23)
- # cursive (25)
- # datomic (7)
- # fulcro (62)
- # java (7)
- # jobs-discuss (8)
- # malli (3)
- # off-topic (22)
- # portal (18)
- # reagent (34)
- # reitit (8)
- # releases (3)
- # shadow-cljs (18)
- # tools-deps (1)
This is super cool, I have a complex data structure I want to visualize thats driven by bb
command line. Is there a way to use portal
as a super print-table
from within by bb
script?
Hi @UMFRQDVU1, this should be possible, portal does work with babashka. All you need to do is p/open
portal from bb and push the data to it via tap>
. Then you can select the table-viewer. You can even add metadata to your data to select a default viewer. Let me know if something is unclear.
Hi @U1G869VNV yea the problem I think is I canโt block the thread so when bb completes it breaks the connection to the portal
And is there docs on adding meta data
It's not currently documented but an example can be found here: https://github.com/djblue/portal/blob/master/src/examples/data.cljc#L82
I am not sure what you mean by can't block the thread. As long as the bb script is running, you should always be able to send data to portal.
yea the problem is my script calls an api, transforms some data spits out an output and exits. So I launch portal but then script exits leaving it orphaned
well thats the part I am confused about i.e. keeping the script blocked while user examines portal, then exit script when portal closes
Ohh, are you are asking how to keep bb from exiting? https://github.com/djblue/portal/blob/master/src/portal/main.clj#L26 is how I do it for portal.main
You can also add
(.addShutdownHook
(Runtime/getRuntime)
(Thread. #(p/close)))
To auto close portal on process exit ๐:thinking_face:
I did put in a feature request for context sensitive displays, been looking at the inspector code may have some patches when I figure this out