Questions tagged [babashka]
14 questions
7
votes
2 answers
Clojure: what's the way to have current time string with babashka with least dependency?
With the following expression,
bb '(new java.util.Date)'
#inst "2020-07-18T14:35:16.663-00:00"
I want to get a string, and slightly formatted as:
"2020-07-18 UTC 14:35:16"
With Babashka (bb), I wish to have the least dependency.
Otherwise, I could…

Yu Shen
- 2,770
- 3
- 33
- 48
3
votes
1 answer
How to filter output of tail with babashka
I want to filter and modify output of tail command. This is what I come up with:
#!/usr/bin/env bb
(ns script
(:require
[clojure.java.io :as io]
[clojure.string :as str]
))
(->> (line-seq (io/reader *in*)
(filter…

serezlan
- 53
- 5
1
vote
1 answer
How can I use ClojureScript's Hiccups library in nbb
I am using the example from the nbb docs on calling nbb from node, which works as expected, generally, using the following (slightly modified) snippets:
;; example.cljs
(ns example)
(defn greet [name] (println "Hello," name)
;; this JS object is…

Sir Robert
- 4,686
- 7
- 41
- 57
1
vote
1 answer
macroexpand doseq in Babashka vs in Clojure
In Babashka v0.6.2, I can call macroexpand on the for macro and the output is something like this:
user=> (macroexpand '(for [i (range 10)] i))
(clojure.core/let [iter__1755__auto__ (clojure.core/fn iter__147 [s__148] (clojure.core/lazy-seq (loop…

erdos
- 3,135
- 2
- 16
- 27
1
vote
2 answers
How to use gcloud with Babashka
I'm trying to use Babashka to replace a few Bash scripts I use to deploy functions on GCP Cloud Functions.
The script below is working, but I wonder if there is a better way to execute the gcloud shell command:
#!/usr/bin/env bb
(require…

jackdbd
- 4,583
- 3
- 26
- 36
1
vote
0 answers
Stackoverflow error in regex after compiling clojure to a jar file
I have a script written in Clojure using babashka that does some text processing. It works fine if I run it with bb command. But when I compile it to a .jar file and run using java command I get java.lang.StackOverflowError.
Exception in thread…

Aliaksandr Sushkevich
- 11,550
- 7
- 37
- 44
0
votes
0 answers
couldn't find the babashka script output
I'm learning babashka using the free ebook bobooka.pdf.
The first exercise in this book is running hello.clj.
When I run the first example in the cli with command bb hello.clj I don't see any output.
However if I run the expression in bb repl I see…

user51
- 8,843
- 21
- 79
- 158
0
votes
1 answer
babashka does not run script - new to babashka
I am new to babashka. When I run a script it appears to do nothing. On cygwin:
$ bb --version
babashka v1.1.172
$ bb '(+ 1 2 3)'
6
$ echo '(+ 1 2 3)' > t.clj
$ cat t.clj
(+ 1 2 3)
$ bb t.clj
<== nothing here!
The same thing is happening…

beluchin
- 12,047
- 4
- 24
- 35
0
votes
2 answers
Exporting environmental variables in Clojure / Babashka
I am trying to write an install script in babaska for my other babaska script (for some fun homogeneity).
Export doesn't seem to work using:
(shell "export NAME=" value)
Is there a canonical way to set environmental variables in Clojure / Babashka?

Jack Gee
- 136
- 6
0
votes
2 answers
Going up a directory in babashka
I am trying to traverse the fp in babashka, and have found that running (shell "cd ..") in my script bb-test causes an error:
----- Error --------------------------------------------------------------------
Type: java.io.IOException
Message: …

Jack Gee
- 136
- 6
0
votes
1 answer
Replicating curl command in babaska
I have the following curl command from the github api that I wish to replicate in babashka:
curl \
-X POST \
-H "Accept: application/json" \
-H "Authorization: Bearer " \
https://api.github.com/user/repos \
-d…

Jack Gee
- 136
- 6
0
votes
2 answers
babashka: no such file or directory
I want to execute:
xlsx2csv ./mytest
And this works when i type and execute it, but when i use babashka it does not work:
source <(ls my* | bb -i '(map #(str "xlsx2csv " %) *input*)')
/proc/self/fd/11:1: no such file or directory: xlsx2csv…

David
- 2,926
- 1
- 27
- 61
0
votes
2 answers
How to use library functions in eval-ed code in Clojure (and Clojure SCI)
I've got a Clojure file which I'm importing other library functions into with :require and :refer in the ns declaration.
I now want to eval some code in that namespace and have it call those libraries.
But when I call it, I get an "Unable to resolve…

interstar
- 26,048
- 36
- 112
- 180
0
votes
1 answer
Babashka: output valid json in a list of json file
I have in input a list of jsons file (let say in.jsons):
{"a": "foo", "b": "bar"}
{"a": "bar", "d": "baz"}
...
I would like to generate a file with the same format, applying some transformation (my-awesome-fn). I would like to use babashka. My…

Patinside
- 13
- 3