This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-01
Channels
- # announcements (7)
- # babashka (72)
- # beginners (62)
- # biff (1)
- # calva (9)
- # cider (8)
- # clj-kondo (35)
- # clj-otel (8)
- # cljsrn (11)
- # clojure (98)
- # clojure-europe (25)
- # clojure-germany (1)
- # clojure-norway (9)
- # clojure-uk (2)
- # clojured (3)
- # clojurescript (12)
- # conjure (3)
- # core-logic (4)
- # cursive (18)
- # datalevin (9)
- # datomic (5)
- # defnpodcast (2)
- # exercism (1)
- # graalvm (5)
- # gratitude (6)
- # hyperfiddle (3)
- # interop (12)
- # jobs (1)
- # joyride (34)
- # lsp (22)
- # meander (14)
- # missionary (16)
- # nbb (88)
- # off-topic (4)
- # pathom (20)
- # podcasts (1)
- # polylith (13)
- # portal (10)
- # re-frame (6)
- # releases (2)
- # remote-jobs (2)
- # rewrite-clj (3)
- # shadow-cljs (3)
- # spacemacs (6)
- # vim (24)
Here is the workflow issue I am facing. The client namespace requires another namespace, a kind of library of functions, let's call it shelltools.
(ns client
(:require [shelltools :refer :all]))
(ns shelltools) has functions defined, eg (shellbb)
I can evaluate the (ns client .. ) form and VS Code even shows the (shellbb) function in Intellisense. However, invoking shellbb fails, because (ns shelltools) and the function have not been yet evaluated in the Repl. I have to go manually into each of the files like shelltools and evaluate them every time the Repl disconnects.
There should be a way to streamline this.> I can evaluate the (ns client .. ) form
After doing so, shellbb
should work I think?
That's the thing, it does not. None of the forms in (ns shelltools) are available in the (ns client) unless I switch to (ns shelltools) and explicitly evaluate them
What if you go into a command line REPL?
rlwrap bb
and then (require 'client) (in-ns 'client) shellbb
user=> (require 'client) (in-ns 'client) shellbb
java.lang.Exception: Could not find namespace: client.
user=> nil
client=> Could not resolve symbol: shellbb [at <repl>:1:35]
client=>
It can't find client either..in the root of the project. Modified
:paths ["script" "resources" "."]
New result
user=> (require 'client) (in-ns 'client) shellbb
nil
user=> nil
client=> #object[sci.impl.fns$fun$arity_0__7322 0x47185cc1 "[email protected]"]
But won't work in VS Code repl (calva)
clj꞉user꞉>
nil
clj꞉client꞉>
; : Could not resolve symbol: shelbb client /
Can you publish this repo or make another repro of this that I can check out locally?
You are right, it does! My fault. I was calling it wrong (
shellbb instead of shelltools/shellbb
What does (in-ns 'client) do?The issue was the link to the project root directory in the :path. I have to re-evaluate the library ns file when I make changes to it, but I can live with it. Beats restarting the repl) Thanks a lot for the great and fast help, as usual! : )
It does reload with
(ns client (:require [shelltools :refer :all ] :reload))
Thanks a lot!Jo I would like to zip
and the resulting zip should be relative to some other dir.
Like this
./a/b/c
-> should end up as c
because I want to zip something that is deep in a file tree. I can also make workarounds with copying into a temp dir or sth
(fs/relativize (fs/path "/home/benj/foo") (fs/path "home/benj/foo/fa"))
related, how do I use this function?relativize:
user=> (fs/relativize (fs/path "/home/benj/foo") (fs/path "/home/benj/foo/fa"))
#object[sun.nio.fs.UnixPath 0x48ca19b3 "fa"]
-r
--recurse-paths
Travel the directory structure recursively; for example:
zip -r foo.zip foo
@U02CV2P4J6S So it's not necessary to cheat anymore, do I understand correctly, or is something missing?
What was hard for me was figuring out something where the entries don't end up nested so deep. I ended up copying the tree (foo) then zip
Ah so you would like (fs/zip "foo.zip" [{:file "foo/bar/baz" :root "foo/bar"}])
or so right?
Does the syntax look ok to you? https://github.com/babashka/fs/issues/67 I think it's worth trying in a PR
I am seeing this error when I launch the tool pgcli https://www.pgcli.com/ with bb.
(defn- run-pgcli*
[]
(let [cmd "pgcli 'host=localhost port=5432 dbname=example user=example password=example'"]
(sh cmd)))
WARNING: your terminal doesn’t support cursor position requests (CPR).If you want to have interactivity, you probably want to use (process "pgcli '...'" {:inherit true})
(let [opts (merge {:inherit true
:dir *cwd*
:shutdown p/destroy-tree}
(dissoc opts :verbose))
I do have the :inherit option set.That wasn't obvious from your previous snippet. Could you maybe write a standalone repro that is fully self-contained?
It turns out I have another process running, which also have {:inherit true}
and this somehow interferes with the pgcli process.
another sibling process. It is spawned along with the pgcli
process from the same parent process.
hola - is there something like a *bb-version*
available from code, or do i need to run bb --version
?
and @borkdude when are you planning to release next? i'm using the new exec like you mentioned to me on github (thanks again), but i'm not gonna bother implementing workarounds if you release quickly (no pressure, really 🙂 )
@U03J48P76RW (System/getProperty "babashka.version")
I want to wait on some feedback from @U055XFK8V if the current babashka master contains enough for the schema.core
PR to make it compatible with bb