Babashka

Clojure scripting without JVM startup.

plurigrid ea6c3df 2 files · 12.2 KB Updated

File contents

babashka

Clojure scripting without JVM startup.

Script

#!/usr/bin/env bb
(require '[babashka.http-client :as http])
(require '[cheshire.core :as json])

(-> (http/get "https://api.github.com/users/bmorphism")
    :body
    (json/parse-string true)
    :public_repos)

Tasks

;; bb.edn
{:tasks
 {:build (shell "make")
  :test  (shell "make test")
  :repl  (babashka.nrepl.server/start-server! {:port 1667})}}

Filesystem

(require '[babashka.fs :as fs])
(fs/glob "." "**/*.clj")
(fs/copy "src" "dst")

Process

(require '[babashka.process :as p])
(-> (p/shell {:out :string} "ls -la") :out)

Run

bb script.clj
bb -e '(+ 1 2)'
bb --nrepl-server

REPL atlas

Part of: repl-commons. Family canonical: clojure.

plurigrid/asi/tree/main/skills/babashka commit ea6c3df921

Frequently asked questions

npx skillmds@latest add plurigrid/babashka