portal

2022-12-09T10:21:33.881549Z

hey folks, I’m trying to integrate portal into my existing project

2022-12-09T10:21:59.190269Z

I created the following alias in my deps.edn

2022-12-09T10:22:02.518019Z

:portal {:extra-deps {cider/cider-nrepl {:mvn/version "0.28.5"}
                                 djblue/portal     {:mvn/version "0.35.0"}}
                    :main-opts ["-m" "nrepl.cmdline"
                                "--middleware" "[portal.nrepl/wrap-portal cider.nrepl/cider-middleware]"
                                "-e" "(require '[portal.api :as p]) (def p (p/open))"]}

2022-12-09T10:22:59.427519Z

sadly the ui won’t autoload, but if i put the code after the “-e” in the repl that opens it opens portal

djblue 2022-12-09T15:12:46.128929Z

When you say autoload, what are you expecting here?

2022-12-09T15:20:02.865289Z

Hi, I was hoping to find a way that when I do a jack in via cider I could automatically pass the code necessary to start the portal web Ui

2022-12-09T15:20:33.905379Z

But found out nrepl has no -e

2022-12-09T15:21:42.791769Z

So I guess I’ll go with the sample code in the documentation to send the code to eval via emacs

djblue 2022-12-09T15:21:57.139309Z

I think you can move the -e before the -m to get clojure to eval the code before invoking the main fn

djblue 2022-12-09T15:22:23.603269Z

Also, make sure to include the add-tap call

2022-12-09T15:28:34.404769Z

That‘d be cool! I saw this a couple of times and was wondering about the order. will try it out when I return to the computer! Thx a bunch!

👍 1
2022-12-09T16:03:41.204749Z

wohoo! it worked, thx!

seancorfield 2022-12-09T18:10:00.278439Z

To explain why: once you have a -m option, everything after that is considered as command-line arguments to the -main function in that namespace -- whereas -e is an argument to the Clojure CLI itself (well, to clojure.main), so -m has to come after -e.

2022-12-09T18:12:31.768769Z

I see, makes a lot of sense. Couldn’t find a lot of info about it in the docs, but thanks to you and @djblue I now know a little more 😅

2022-12-09T10:23:08.857589Z

any hints on what I’m doing wrong?

gdubs 2022-12-09T22:41:17.774529Z

I can diff two maps in portal. Everytime I tap two new maps, do I have to tell the portal web app to re-diff them? Or is there a way I can tell portal to diff them from my repl?

gdubs 2022-12-09T22:41:44.938719Z

gdubs 2022-12-09T22:42:56.515209Z

I don't see anything obvious from the api docs

djblue 2022-12-09T22:42:59.896709Z

(tap> (with-meta [map1 map2] {:portal.viewer/default :portal.viewer/diff}))

❤️ 1
djblue 2022-12-09T22:43:17.419729Z

If you have both of the maps at the same time, ☝️ might work a little better

djblue 2022-12-09T22:44:15.809929Z

FYI the list/vector can contain more than two maps 👌

👍 1
gdubs 2022-12-09T22:44:20.524949Z

that worked, thanks!

gdubs 2022-12-09T22:44:42.948389Z

any way to tell it to expand the map elements to a certain depth?

djblue 2022-12-09T22:45:32.228759Z

Not currently, but you can switch to the tree viewer if that helps

👍 1
gdubs 2022-12-09T22:46:52.104959Z

hey, it seems to remember what depth I previously had expanded them to when I load new maps. Works for me!