Fork me on GitHub
#portal
<
2022-12-09
>
dev-hartmann10:12:33

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

dev-hartmann10:12:59

I created the following alias in my deps.edn

dev-hartmann10:12:02

: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))"]}

dev-hartmann10:12:59

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

djblue15:12:46

When you say autoload, what are you expecting here?

dev-hartmann15:12:02

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

dev-hartmann15:12:33

But found out nrepl has no -e

dev-hartmann15:12:42

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

djblue15:12:57

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

djblue15:12:23

Also, make sure to include the add-tap call

dev-hartmann15:12:34

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
dev-hartmann16:12:41

wohoo! it worked, thx!

seancorfield18:12:00

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.

dev-hartmann18:12:31

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

dev-hartmann10:12:08

any hints on what I’m doing wrong?

gdubs22:12:17

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?

gdubs22:12:56

I don't see anything obvious from the api docs

djblue22:12:59

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

❤️ 1
djblue22:12:17

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

djblue22:12:15

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

👍 1
gdubs22:12:20

that worked, thanks!

gdubs22:12:42

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

djblue22:12:32

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

👍 1
gdubs22:12:52

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