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 @djblue 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
(with-meta <data> {:portal.viewer/default :portal.viewer/table})
should work
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.
Data is always sent async 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
Is there a problem with keeping the bb script running?
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:
That works Thanks!!!\
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
I responded, not sure where the better place is to have the conversation π
Cool discussion. It might be worth documenting this somewhere?