Fork me on GitHub
#babashka
<
2023-01-20
>
adam-james02:01:37

Since borkdude so nicely made a release of babashka that works with my ‘solenoid’ library, I’ve made an https://github.com/adam-james-v/solenoid/blob/main/examples/example-script.clj Screenshot in 🧵 just for fun 🙂

clojure-spin 6
ordnungswidrig08:01:14

Is there some edn "query tool" like jq for json? I can write something for my particular use case (finding the path to all entries in a edn structure which match a certain condition), but I have the feeling somebody did the work already.

borkdude08:01:43

There is #CM5HRADAA which also comes with specter, perhaps specter has something for this. It also supports regular clojure of course

ordnungswidrig08:01:34

Specter looks promising but I could not find a way to return the "current path"

borkdude08:01:51

well perhaps jet should have a built-in function for this (if jq has this) - feel free to post an issue

ordnungswidrig08:01:15

I'm actually not sure if jq has this 😛

ordnungswidrig08:01:36

I thought it makes sense when you can query on a data structure that you could get the location of the result as well

ordnungswidrig08:01:35

E.g. for {:foo {:bar {:t 1 :u 1} } :qux {:quux {:t 1 u:2}}} I want to query for all paths which have the :t key in the final position.

borkdude10:01:36

Here is a way to add dependencies to babashka using tools-deps-native. https://github.com/babashka/babashka/wiki/Adding-dependencies-without-Java-using-tools-deps-native This should be considered EXPERIMENTAL and doesn't really buy you anything other than not having to install Java which for some people / contexts may be useful.

👀 6
👍 4
borkdude20:01:30

https://github.com/borkdude/carve is now compatible with #babashka :

bb -Sdeps '{:deps {io.github.borkdude/carve {:git/sha "c8b12536527b5bd3da6ad4f3084122dbc36dfbc8"}}}' -x carve.api/carve! --paths src
cc @escherize

🙏 4
wow 4
🎉 4
borkdude20:01:07

I'll make a mvn/release after the weekend

escherize20:01:05

Maybe I did something wrong but when I run this, I get the following message:

bb -Sdeps '{:deps {io.github.borkdude/carve {:git/sha "c8b12536527b5bd3da6ad4f3084122dbc36dfbc8"}}}' -x carve.api/carve! --paths src
Cloning: 
Checking out:  at c8b12536527b5bd3da6ad4f3084122dbc36dfbc8
Downloading: clj-kondo/clj-kondo/2023.01.20/clj-kondo-2023.01.20.pom from clojars
Downloading: clj-kondo/clj-kondo/2023.01.20/clj-kondo-2023.01.20.jar from clojars
[babashka] WARNING: Use the babashka-compatible version of clojure.spec.alpha, available here: 
----- Error --------------------------------------------------------------------
Type:     java.lang.Exception
Message:  Could not find namespace: clojure.spec.alpha.
Location: /Users/bcm/.gitlibs/libs/io.github.borkdude/carve/c8b12536527b5bd3da6ad4f3084122dbc36dfbc8/src/carve/impl.clj:4:3

----- Context ------------------------------------------------------------------
1: (ns carve.impl
2:   {:no-doc true}
3:   (:refer-clojure :exclude [run!])
4:   (:require
     ^--- Could not find namespace: clojure.spec.alpha.
5:    [clojure.edn :as edn]
6:    [ :as io]
7:    [clojure.set :as set]
8:    [clojure.spec.alpha :as s]
9:    [clojure.string :as str]

----- Stack trace --------------------------------------------------------------
carve.impl                                - /Users/bcm/.gitlibs/libs/io.github.borkdude/carve/c8b12536527b5bd3da6ad4f3084122dbc36dfbc8/src/carve/impl.clj:4:3
carve.api                                 - /Users/bcm/.gitlibs/libs/io.github.borkdude/carve/c8b12536527b5bd3da6ad4f3084122dbc36dfbc8/src/carve/api.clj:3:3
exec-9159b317-d4ee-41ce-9fa2-d831c5cdcbdb - <expr>:4:1

escherize20:01:27

maybe need to clear a cache somewhere

borkdude20:01:31

Update your babashka version

borkdude20:01:46

no worries :)

😆 2
escherize20:01:21

Upgrading 1 outdated package: borkdude/brew/babashka 1.0.166 -> 1.0.170

borkdude20:01:22

Use:

--paths src --report --report-format :text
for text output

👍 2