This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-21
Channels
- # adventofcode (8)
- # announcements (20)
- # babashka (43)
- # beginners (8)
- # biff (12)
- # calva (2)
- # cider (5)
- # clerk (6)
- # clj-commons (12)
- # clj-kondo (16)
- # clojure (20)
- # clojure-denver (1)
- # clojure-europe (14)
- # clojure-nl (1)
- # clojure-norway (105)
- # clojure-uk (2)
- # clojuredesign-podcast (5)
- # clojurescript (29)
- # datomic (2)
- # hyperfiddle (13)
- # jackdaw (1)
- # jobs (4)
- # jobs-discuss (4)
- # lsp (2)
- # malli (12)
- # pathom (2)
- # pedestal (1)
- # re-frame (22)
- # shadow-cljs (37)
- # squint (28)
- # xtdb (28)
- # yamlscript (4)
I'm trying to run a simple task that uses a function that is defined in ./scripts/ file. Like this: bb.edn
{:paths ["scripts"]
:deps {borkdude/rewrite-edn {:mvn/version "0.4.7"}}
:tasks
{foo {:doc "foo"
:requires ([scripts.foo])
:task (prn "foo")}}}
and I have:
./scripts/foo.clj
(ns scripts.foo)
(defn foo-bar []
(println "foobar"))
Here's how the dir looks:
.
├── README.md
├── bb.edn
├── deps.edn
├── scripts
│ └── foo.clj
When I do bb tasks
, it shows it. But when I run it: bb foo
or bb run foo
, it can't find it:
Type: java.io.FileNotFoundException
Message: Could not locate scripts/foo.bb, scripts/foo.clj or scripts/foo.cljc on classpath.
WAT?I believe that the scripts dir is on the 'classpath', so you could change paths to just ["."], or change the ns structure to be rooted in ./scripts
instead of .
./scripts/foo.clj
(ns foo) <-- change this to foo
(defn foo-bar []
(println "foobar"))
./bb.edn
{:paths ["scripts"]
:deps {borkdude/rewrite-edn {:mvn/version "0.4.7"}}
:tasks
{foo {:doc "foo"
:requires ([foo]) <-- change this to foo
:task (prn "foo")}}}
Ah... you know what happened? I previously ran: export BABASHKA_CLASSPATH=$(clojure -Spath) and totally forgot about that
I imagine that it's because bb.edn is an edn file, so most things aren't executed by default. Presumably this and related functionality would require executing code from the edn file to list tasks. I don't see an existing feature request in the repo for it.
I’d like to get the (PEM formatted) ssl cert from a mqtt broker using babashka. From the command-line I can do it with this:
openssl s_client -connect HOST:8883 -showcerts < /dev/null 2> /dev/null | sed -n '/BEGIN/,/END/p' >/tmp/bbl.crt
I’d like to get it from within a babshka script however and I’m wondering if there is a way to do it without shelling out?No - because I thought that bb wouldn’t have the classes. But let me look.
Ok - so I haven’t done a ton of interop stuff. I think I need javax.net.ssl
whic does appear to be in bb. However, when I try to (.createSocket (
I get clojure.lang.ExceptionInfo: Method createSocket on class sun.security.ssl.SSLSocketFactoryImpl not allowed! user *cider-repl Git_Repos/bbl:127.0.0.1:59425(clj)*:1:2
I am not sure if this is something I’m doing wrong, or something else. Any hints?
I believe the final solution is the accepted answer here:https://stackoverflow.com/questions/10577029/how-do-i-retrieve-an-untrusted-ssl-server-certificate-in-order-to-review-and-tru
I’m working in JVM clojure now and I do get past the error I listed above ( (.createSocket (
Works fine. However, now I’m running into issues with reify for the custom X509 trust manager. That’s a different thing though. At this point I’m trying to get a sense on if this is ultimately going to not workout in bb and if I should just bite the bullet and shell out for it.
@U0250GGJGAE Ah got it. In babashka.http-client I'm doing something very similar and I think you could just copy that and modify it
Oh - ok, I’ll look at that code, ty.
ooh proxy
I was just about to try that over reify
ok, thanks - will try this 👍
probably then don't go through HttpsUrlConnection but through java.net.http stuff which is fully supported in bb
empty bb.edn will blowup babashka, while bb.edn with empty map won't, does this consider a bug for bb 😄 https://clojure.atlassian.net/browse/TDEPS-239
yeah ok :)
$ bb -Sdeps ''
Error during loading bb.edn:
Exception in thread "main" java.lang.RuntimeException: EOF while reading
https://github.com/babashka/babashka/issues/1652 there u go:raised_hands:
bb
matches the behavior of clojure
here:
(~/clojure)-(!2002)-> mkdir q && cd q && touch deps.edn && clj
Error building classpath. Expected edn map in: /home/sean/clojure/q/deps.edn
Thu Dec 21 09:27:59
(~/clojure/q)-(!2003)-> echo '{}' > deps.edn && clj
Clojure 1.11.1
user=>
(although clj -Sdeps ''
works fine, strangely)
> it's going to be fixed Eventually, maybe 🙂 Perhaps.
hey beloved babashka peeps
I’ve been thinking about interactive cli patterns… like when you have several options, and you want the user to select one of them
then the user can start typing and filter the list…
does anyone know any bb plugins/bash programs that can do that?
I know https://invisible-island.net/dialog/, but that opens a whole menu. It’s cool for some use cases, but I wanted something that is straight in the command line…. much like assume
from https://granted.dev does…