diff --git a/README.md b/README.md index af1a78e0..1bde16c3 100644 --- a/README.md +++ b/README.md @@ -280,7 +280,7 @@ Additional libraries: - [`org.httpkit.server`](https://github.com/http-kit/http-kit) (experimental) See the -[libraries](https://github.com/borkdude/babashka/blob/master/doc/libraries.md) +[projects](https://github.com/borkdude/babashka/blob/master/doc/projects.md) page for libraries that are not built-in, but which you can load from source via the `--classpath` option. @@ -371,7 +371,7 @@ to parse command line arguments, you may use the built-in `clojure.tools.cli` namespace (see [docs](https://github.com/borkdude/babashka#parsing-command-line-arguments)) or use the -[nubank/docopt](https://github.com/borkdude/babashka/blob/master/doc/libraries.md#nubankdocopt) +[nubank/docopt](https://github.com/borkdude/babashka/blob/master/doc/projects.md#nubankdocopt) library. ### Babashka namespaces @@ -1017,7 +1017,7 @@ Differences with Clojure: - The `clojure.core.async/go` macro is not (yet) supported. For compatibility it currently maps to `clojure.core.async/thread`. More info [here](#coreasync). -## [Libraries, pods and projects](doc/libraries.md) +## [Libraries, pods and projects](doc/projects.md) A list of projects (scripts, libraries, pods and tools) known to work with babashka. diff --git a/doc/libraries.md b/doc/libraries.md index 6da0f383..1462a781 100644 --- a/doc/libraries.md +++ b/doc/libraries.md @@ -1,394 +1 @@ -# Libraries and projects - -The following libraries and projects are known to work with babashka. - -Table of contents: - -- [Libraries](#libraries) -- [Pods](#pods) -- [Projects](#projects) - -## Libraries - -### [clj-http-lite](https://github.com/babashka/clj-http-lite) - -A fork of a fork of `clj-http-lite`. Example: - -``` shell -$ export BABASHKA_CLASSPATH="$(clojure -Sdeps '{:deps {clj-http-lite {:git/url "https://github.com/babashka/clj-http-lite" :sha "f44ebe45446f0f44f2b73761d102af3da6d0a13e"}}}' -Spath)" - -$ bb "(require '[clj-http.lite.client :as client]) (:status (client/get \"https://www.clojure.org\"))" -200 -``` - -### [spartan.spec](https://github.com/borkdude/spartan.spec/) - -An babashka-compatible implementation of `clojure.spec.alpha`. - -### [missing.test.assertions](https://github.com/borkdude/missing.test.assertions) - -This library checks if no assertions have been made in a test: - -``` shell -$ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {borkdude/missing.test.assertions {:git/url "https://github.com/borkdude/missing.test.assertions" :sha "603cb01bee72fb17addacc53c34c85612684ad70"}}}') - -$ lein bb "(require '[missing.test.assertions] '[clojure.test :as t]) (t/deftest foo) (t/run-tests)" - -Testing user -WARNING: no assertions made in test foo - -Ran 1 tests containing 0 assertions. -0 failures, 0 errors. -{:test 1, :pass 0, :fail 0, :error 0, :type :summary} -``` - -### [medley](https://github.com/weavejester/medley/) - -Requires `bb` >= v0.0.71. Latest coordinates checked with with bb: - -``` clojure -{:git/url "https://github.com/weavejester/medley" :sha "a4e5fb5383f5c0d83cb2d005181a35b76d8a136d"} -``` - -Example: - -``` shell -$ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {medley {:git/url "https://github.com/weavejester/medley" :sha "a4e5fb5383f5c0d83cb2d005181a35b76d8a136d"}}}') - -$ bb -e "(require '[medley.core :as m]) (m/index-by :id [{:id 1} {:id 2}])" -{1 {:id 1}, 2 {:id 2}} -``` - -### [limit-break](https://github.com/technomancy/limit-break) - -A debug REPL library. - -Latest coordinates checked with with bb: - -``` clojure -{:git/url "https://github.com/technomancy/limit-break" :sha "050fcfa0ea29fe3340927533a6fa6fffe23bfc2f" :deps/manifest :deps} -``` - -Example: - -``` shell -$ export BABASHKA_CLASSPATH="$(clojure -Sdeps '{:deps {limit-break {:git/url "https://github.com/technomancy/limit-break" :sha "050fcfa0ea29fe3340927533a6fa6fffe23bfc2f" :deps/manifest :deps}}}' -Spath)" - -$ bb "(require '[limit.break :as lb]) (let [x 1] (lb/break))" -Babashka v0.0.49 REPL. -Use :repl/quit or :repl/exit to quit the REPL. -Clojure rocks, Bash reaches. - -break> x -1 -``` - -### [clojure-csv](https://github.com/davidsantiago/clojure-csv) - -A library for reading and writing CSV files. Note that babashka already comes -with `clojure.data.csv`, but in case you need this other library, this is how -you can use it: - -``` shell -export BABASHKA_CLASSPATH="$(clojure -Sdeps '{:deps {clojure-csv {:mvn/version "RELEASE"}}}' -Spath)" - -./bb -e " -(require '[clojure-csv.core :as csv]) -(csv/write-csv (csv/parse-csv \"a,b,c\n1,2,3\")) -" -``` - -### [regal](https://github.com/lambdaisland/regal) - -Requires `bb` >= v0.0.71. Latest coordinates checked with with bb: - -``` clojure -{:git/url "https://github.com/lambdaisland/regal" :sha "d4e25e186f7b9705ebb3df6b21c90714d278efb7"} -``` - -Example: - -``` shell -$ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {regal {:git/url "https://github.com/lambdaisland/regal" :sha "d4e25e186f7b9705ebb3df6b21c90714d278efb7"}}}') - -$ bb -e "(require '[lambdaisland.regal :as regal]) (regal/regex [:* \"ab\"])" -#"(?:\Qab\E)*" -``` - -### [cprop](https://github.com/tolitius/cprop/) - -A clojure configuration libary. Latest test version: `"0.1.16"`. - -### [comb](https://github.com/weavejester/comb) - -Simple templating system for Clojure. Latest tested version: `"0.1.1"`. - -``` clojure -$ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {comb {:mvn/version "0.1.1"}}}') -$ rlwrap bb -... -user=> (require '[comb.template :as template]) -user=> (template/eval "<% (dotimes [x 3] %>foo<% ) %>") -"foofoofoo" -user=> (template/eval "Hello <%= name %>" {:name "Alice"}) -"Hello Alice" -user=> (def hello (template/fn [name] "Hello <%= name %>")) -user=> (hello "Alice") -"Hello Alice" -``` - -### [nubank/docopt](https://github.com/nubank/docopt.clj#babashka) - -Docopt implementation in Clojure, compatible with babashka. - -### [arrangement](https://github.com/greglook/clj-arrangement) - -A micro-library which provides a total-ordering comparator for Clojure -values. Tested with version `1.2.0`. - -### [clojure.math.combinatorics](https://github.com/clojure/math.combinatorics) - -``` clojure -$ bb --classpath "$(clojure -Spath -Sdeps '{:deps {org.clojure/math.combinatorics {:mvn/version "0.1.6"}}}')" \ - -e "(use 'clojure.math.combinatorics) (permutations [:a :b])" -((:a :b) (:b :a)) -``` - -### [testdoc](https://github.com/liquidz/testdoc) - -Yet another doctest implementation in Clojure. - -``` clojure -$ export BABASHKA_CLASSPATH=$(clojure -Sdeps '{:deps {testdoc {:mvn/version "1.2.0"}}}' -Spath) - -$ bb '(ns foo (:use clojure.test testdoc.core)) -(defn foo " - => (foo) - :foox" - [] :foo) - -(deftest footest - (is (testdoc (var foo)))) - -(test-var (var footest))' - -FAIL in (footest) (:1) -(= (foo) :foox) -expected: :foox - actual: :foo -``` - -### [doric](https://github.com/joegallo/doric) - -Library for printing tables. - -``` clojure -$ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {doric {:mvn/version "0.9.0"}}}') -$ bb "(use 'doric.core) (println (table [:a :b :c] [{:a 1 :b 2 :c 3} {:a 4 :b 5 :c 6}]))" -|---+---+---| -| A | B | C | -|---+---+---| -| 1 | 2 | 3 | -| 4 | 5 | 6 | -|---+---+---| -``` - -### [clojure.data.zip](https://github.com/clojure/data.zip) - -Utilities for clojure.zip, among other things a more fluent way to work -with xml. - -Small sample: -``` clojure -$ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {org.clojure/data.zip {:mvn/version "1.0.0"}}}') - -$ cat data_zip_xml.clj -(require '[clojure.data.xml :as xml]) -(require '[clojure.zip :as zip]) -(require '[clojure.data.zip.xml :refer [text attr attr= xml-> xml1-> text=]]) - -(def data (str "" - " " - " " - "")) - -(let [xml (-> data java.io.StringReader. xml/parse zip/xml-zip)] - (prn :alice-is-a (xml1-> xml :character [(attr= :name "alice")] (attr :type))) - (prn :animal-is-called (xml1-> xml :character [(attr= :type "animal")] (attr :name)))) - -$ bb data_zip_xml.clj -:alice-is-a "person" -:animal-is-called "march hare" -``` -(see for exaple [this article](https://blog.korny.info/2014/03/08/xml-for-fun-and-profit.html#datazip-for-zipper-awesomeness) -for more on clojure.data.zip). - -### [clj-psql](https://github.com/DarinDouglass/clj-psql) - -A small Clojure wrapper for interacting with `psql`. - -```clojure -user> (psql/query conn "select name, subject from grades where grade = 100") - => ({:name "Bobby Tables", :subject "Math"} - {:name "Suzy Butterbean", :subject "Math"}) -``` - -### [camel-snake-kebab](https://github.com/clj-commons/camel-snake-kebab) - -A library for word case conversions. - -### [aero](https://github.com/juxt/aero/) - -A small library for explicit, intentful configuration. - -### [clojure.data.generators](https://github.com/clojure/data.generators) - -Random data generators - -### [honeysql](https://github.com/seancorfield/honeysql) - -Turn Clojure data structures into SQL - -### [bond](https://github.com/circleci/bond) - -Spying and stubbing library, primarily intended for tests. - -### [portal](https://github.com/djblue/portal/) - -A clojure tool to navigate through your data. This example will launch a browser to view your `deps.edn`: - -``` clojure -$ cat deps.edn | bb -cp `clojure -Spath -Sdeps '{:deps {djblue/portal {:mvn/version "0.4.1"}}}'` -m portal.main edn -``` - -### [version-clj](https://github.com/xsc/version-clj) - -Analysis and comparison of artifact version numbers. - -``` clojure -> export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {version-clj/version-clj {:mvn/version "0.1.2"}}}') -> bb --repl -... -user=> (require '[version-clj.core :as ver]) -nil -user=> (ver/version->seq "1.0.0-SNAPSHOT") -[(1 0 0) ["snapshot"]] -user=> (ver/version-compare "1.2.3" "1.0.0") -1 -user=> (ver/version-compare "1.0.0-SNAPSHOT" "1.0.0") --1 -user=> (ver/version-compare "1.0" "1.0.0") -0 -``` - -## Pods - -[Babashka pods](https://github.com/babashka/babashka.pods) are programs that can -be used as Clojure libraries by babashka. - -- [babashka-sql-pods](https://github.com/babashka/babashka-sql-pods): pods for - interacting with SQL databases (PostgreSQL and HSQLDB) -- [bootleg](https://github.com/retrogradeorbit/bootleg): static HTML website - generation -- [brisk](https://github.com/justone/brisk): Freeze and thaw with Nippy at the - command line -- [clj-kondo](https://github.com/borkdude/clj-kondo/#babashka-pod): a Clojure - linter -- [pod-babashka-filewatcher](https://github.com/babashka/pod-babashka-filewatcher): a - filewatcher pod based on Rust notify -- [pod-babashka-lanterna](https://github.com/babashka/pod-babashka-lanterna): a - pod for making TUIs based on - [clojure-lanterna](https://github.com/babashka/clojure-lanterna) -- [pod-babashka-parcera](https://github.com/babashka/pod-babashka-parcera): pod around the parcera Clojure parser -- [pod-janet-peg](https://github.com/sogaiu/pod-janet-peg): a pod for - calling [Janet](https://github.com/janet-lang/janet)'s PEG - functionality -- [pod-jaydeesimon-jsoup](https://github.com/jaydeesimon/pod-jaydeesimon-jsoup): - a pod for parsing HTML using CSS queries backed by Jsoup -- [pod-lispyclouds-docker](https://github.com/lispyclouds/pod-lispyclouds-docker): - A pod for interacting with docker -- [pod-tzzh-aws](https://github.com/tzzh/pod-tzzh-aws): pod for interacting with AWS -- [pod-tzzh-kafka](https://github.com/tzzh/pod-tzzh-kafka): pod for interacting with Kafka -- [pod-tzzh-mail](https://github.com/tzzh/pod-tzzh-mail): pod for sending mail -- [pod.xledger.sql-server](https://github.com/xledger/pod_sql_server): pod for interacting with SQL Server -- [tabl](https://github.com/justone/tabl): Make tables from data in your terminal - -## Projects - -### [babashka-test-action](https://github.com/marketplace/actions/babashka-test-action) - -Github Action to run clojure.test by Babashka. - -### [deps.clj](https://github.com/borkdude/deps.clj) - -A port of the [clojure](https://github.com/clojure/brew-install/) bash script to -Clojure / babashka. - -Also see [deps.clj documentation](../doc/deps.clj.md). - -### [4bb](https://github.com/porkostomus/4bb) - -4clojure as a babashka script! - -### [babashka lambda layer](https://github.com/dainiusjocas/babashka-lambda-layer) - -Babashka Lambda runtime packaged as a Lambda layer. - -### [Release on push Github action](https://github.com/rymndhng/release-on-push-action) - -Github Action to create a git tag + release when pushed to master. Written in -babashka. - -### [justone/bb-scripts](https://github.com/justone/bb-scripts) - -A collection of scripts developed by [@justone](https://github.com/justone). - -### [nativity](https://github.com/MnRA/nativity) - -Turn babashka scripts into binaries using GraalVM `native-image`. - -### [cldwalker/bb-clis](https://github.com/cldwalker/bb-clis) - -A collection of scripts developed by [@cldwalker](https://github.com/cldwalker). - -### [krell template](https://github.com/ampersanda/krell-template-runner) - -Babashka script for creating React Native (Krell) project - -### [wee-httpd](https://github.com/bherrmann7/bb-common/blob/master/wee_httpd.bb) - -A wee multi-threaded web server - -### [covid19-babashka](https://github.com/agrison/covid19-babashka) - -A babashka script to obtain covid-19 related information. - -### [bb-spotify](https://github.com/kolharsam/bb-spotify) - -Contol your spotify player using babashka. - -### [lambdaisland/open-source](https://github.com/lambdaisland/open-source) - -[Internal -tooling](https://github.com/borkdude/babashka/issues/457#issuecomment-636739415) -used by Lambda Island projects. Noteworthy: a [babashka-compatible hiccup -script](https://github.com/lambdaisland/open-source/blob/2cfde3dfb460e72f047bf94e6f5ec7f519c6d7a0/src/lioss/hiccup.clj). - -There's also -[subshell](https://github.com/lambdaisland/open-source/blob/master/src/lioss/subshell.clj) -which is like sh/sh, but it inherits stdin/stdout/stderr, so that the user sees -in real time what the subprocess is doing, and can possibly interact with -it. More like how shelling out in a bash script works. - -### [dharrigan/spotifyd-notification](https://github.com/dharrigan/spotifyd-notification) - -An example of using babashka to show spotifyd notifications via dunst. - -### [nextjournal/ssh-github-auth](https://github.com/nextjournal/ssh-github-auth) - -A babashka script which uses github auth to fetch SSH public keys. It can be useful to ensure only a certain team of people can access machines with SSH. - -### [turtlequeue/setup-babashka](https://github.com/turtlequeue/setup-babashka) - -Github Action to install Babashka in your workflows. Useful to run bb scripts in your CI. - +Moved to [projects.md](projects.md). diff --git a/doc/news.md b/doc/news.md index df2dd942..8b60182f 100644 --- a/doc/news.md +++ b/doc/news.md @@ -10,6 +10,8 @@ Twitter. Babashka [survey](https://nl.surveymonkey.com/r/H2HK3RC). Feedback will be used for future development. +- [Stash](https://github.com/rorokimdim/stash): a CLI for encrypted text storage + written in Haskell, accessible as pod from babashka and Python! - NextJournal released a babashka [notebook environment](http://nextjournal.com/try/babashka?cm6=1). - [Interdep](https://github.com/rejoice-cljc/interdep) manages interdependent dependencies using Clojure's tools.deps and babashka. diff --git a/doc/projects.md b/doc/projects.md new file mode 100644 index 00000000..48cce328 --- /dev/null +++ b/doc/projects.md @@ -0,0 +1,398 @@ +# Projects + +The following libraries and projects are known to work with babashka. + +Table of contents: + +- [Libraries](#libraries) +- [Pods](#pods) +- [Projects](#projects) + +## Libraries + +### [clj-http-lite](https://github.com/babashka/clj-http-lite) + +A fork of a fork of `clj-http-lite`. Example: + +``` shell +$ export BABASHKA_CLASSPATH="$(clojure -Sdeps '{:deps {clj-http-lite {:git/url "https://github.com/babashka/clj-http-lite" :sha "f44ebe45446f0f44f2b73761d102af3da6d0a13e"}}}' -Spath)" + +$ bb "(require '[clj-http.lite.client :as client]) (:status (client/get \"https://www.clojure.org\"))" +200 +``` + +### [spartan.spec](https://github.com/borkdude/spartan.spec/) + +An babashka-compatible implementation of `clojure.spec.alpha`. + +### [missing.test.assertions](https://github.com/borkdude/missing.test.assertions) + +This library checks if no assertions have been made in a test: + +``` shell +$ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {borkdude/missing.test.assertions {:git/url "https://github.com/borkdude/missing.test.assertions" :sha "603cb01bee72fb17addacc53c34c85612684ad70"}}}') + +$ lein bb "(require '[missing.test.assertions] '[clojure.test :as t]) (t/deftest foo) (t/run-tests)" + +Testing user +WARNING: no assertions made in test foo + +Ran 1 tests containing 0 assertions. +0 failures, 0 errors. +{:test 1, :pass 0, :fail 0, :error 0, :type :summary} +``` + +### [medley](https://github.com/weavejester/medley/) + +Requires `bb` >= v0.0.71. Latest coordinates checked with with bb: + +``` clojure +{:git/url "https://github.com/weavejester/medley" :sha "a4e5fb5383f5c0d83cb2d005181a35b76d8a136d"} +``` + +Example: + +``` shell +$ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {medley {:git/url "https://github.com/weavejester/medley" :sha "a4e5fb5383f5c0d83cb2d005181a35b76d8a136d"}}}') + +$ bb -e "(require '[medley.core :as m]) (m/index-by :id [{:id 1} {:id 2}])" +{1 {:id 1}, 2 {:id 2}} +``` + +### [limit-break](https://github.com/technomancy/limit-break) + +A debug REPL library. + +Latest coordinates checked with with bb: + +``` clojure +{:git/url "https://github.com/technomancy/limit-break" :sha "050fcfa0ea29fe3340927533a6fa6fffe23bfc2f" :deps/manifest :deps} +``` + +Example: + +``` shell +$ export BABASHKA_CLASSPATH="$(clojure -Sdeps '{:deps {limit-break {:git/url "https://github.com/technomancy/limit-break" :sha "050fcfa0ea29fe3340927533a6fa6fffe23bfc2f" :deps/manifest :deps}}}' -Spath)" + +$ bb "(require '[limit.break :as lb]) (let [x 1] (lb/break))" +Babashka v0.0.49 REPL. +Use :repl/quit or :repl/exit to quit the REPL. +Clojure rocks, Bash reaches. + +break> x +1 +``` + +### [clojure-csv](https://github.com/davidsantiago/clojure-csv) + +A library for reading and writing CSV files. Note that babashka already comes +with `clojure.data.csv`, but in case you need this other library, this is how +you can use it: + +``` shell +export BABASHKA_CLASSPATH="$(clojure -Sdeps '{:deps {clojure-csv {:mvn/version "RELEASE"}}}' -Spath)" + +./bb -e " +(require '[clojure-csv.core :as csv]) +(csv/write-csv (csv/parse-csv \"a,b,c\n1,2,3\")) +" +``` + +### [regal](https://github.com/lambdaisland/regal) + +Requires `bb` >= v0.0.71. Latest coordinates checked with with bb: + +``` clojure +{:git/url "https://github.com/lambdaisland/regal" :sha "d4e25e186f7b9705ebb3df6b21c90714d278efb7"} +``` + +Example: + +``` shell +$ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {regal {:git/url "https://github.com/lambdaisland/regal" :sha "d4e25e186f7b9705ebb3df6b21c90714d278efb7"}}}') + +$ bb -e "(require '[lambdaisland.regal :as regal]) (regal/regex [:* \"ab\"])" +#"(?:\Qab\E)*" +``` + +### [cprop](https://github.com/tolitius/cprop/) + +A clojure configuration libary. Latest test version: `"0.1.16"`. + +### [comb](https://github.com/weavejester/comb) + +Simple templating system for Clojure. Latest tested version: `"0.1.1"`. + +``` clojure +$ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {comb {:mvn/version "0.1.1"}}}') +$ rlwrap bb +... +user=> (require '[comb.template :as template]) +user=> (template/eval "<% (dotimes [x 3] %>foo<% ) %>") +"foofoofoo" +user=> (template/eval "Hello <%= name %>" {:name "Alice"}) +"Hello Alice" +user=> (def hello (template/fn [name] "Hello <%= name %>")) +user=> (hello "Alice") +"Hello Alice" +``` + +### [nubank/docopt](https://github.com/nubank/docopt.clj#babashka) + +Docopt implementation in Clojure, compatible with babashka. + +### [arrangement](https://github.com/greglook/clj-arrangement) + +A micro-library which provides a total-ordering comparator for Clojure +values. Tested with version `1.2.0`. + +### [clojure.math.combinatorics](https://github.com/clojure/math.combinatorics) + +``` clojure +$ bb --classpath "$(clojure -Spath -Sdeps '{:deps {org.clojure/math.combinatorics {:mvn/version "0.1.6"}}}')" \ + -e "(use 'clojure.math.combinatorics) (permutations [:a :b])" +((:a :b) (:b :a)) +``` + +### [testdoc](https://github.com/liquidz/testdoc) + +Yet another doctest implementation in Clojure. + +``` clojure +$ export BABASHKA_CLASSPATH=$(clojure -Sdeps '{:deps {testdoc {:mvn/version "1.2.0"}}}' -Spath) + +$ bb '(ns foo (:use clojure.test testdoc.core)) +(defn foo " + => (foo) + :foox" + [] :foo) + +(deftest footest + (is (testdoc (var foo)))) + +(test-var (var footest))' + +FAIL in (footest) (:1) +(= (foo) :foox) +expected: :foox + actual: :foo +``` + +### [doric](https://github.com/joegallo/doric) + +Library for printing tables. + +``` clojure +$ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {doric {:mvn/version "0.9.0"}}}') +$ bb "(use 'doric.core) (println (table [:a :b :c] [{:a 1 :b 2 :c 3} {:a 4 :b 5 :c 6}]))" +|---+---+---| +| A | B | C | +|---+---+---| +| 1 | 2 | 3 | +| 4 | 5 | 6 | +|---+---+---| +``` + +### [clojure.data.zip](https://github.com/clojure/data.zip) + +Utilities for clojure.zip, among other things a more fluent way to work +with xml. + +Small sample: +``` clojure +$ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {org.clojure/data.zip {:mvn/version "1.0.0"}}}') + +$ cat data_zip_xml.clj +(require '[clojure.data.xml :as xml]) +(require '[clojure.zip :as zip]) +(require '[clojure.data.zip.xml :refer [text attr attr= xml-> xml1-> text=]]) + +(def data (str "" + " " + " " + "")) + +(let [xml (-> data java.io.StringReader. xml/parse zip/xml-zip)] + (prn :alice-is-a (xml1-> xml :character [(attr= :name "alice")] (attr :type))) + (prn :animal-is-called (xml1-> xml :character [(attr= :type "animal")] (attr :name)))) + +$ bb data_zip_xml.clj +:alice-is-a "person" +:animal-is-called "march hare" +``` +(see for exaple [this article](https://blog.korny.info/2014/03/08/xml-for-fun-and-profit.html#datazip-for-zipper-awesomeness) +for more on clojure.data.zip). + +### [clj-psql](https://github.com/DarinDouglass/clj-psql) + +A small Clojure wrapper for interacting with `psql`. + +```clojure +user> (psql/query conn "select name, subject from grades where grade = 100") + => ({:name "Bobby Tables", :subject "Math"} + {:name "Suzy Butterbean", :subject "Math"}) +``` + +### [camel-snake-kebab](https://github.com/clj-commons/camel-snake-kebab) + +A library for word case conversions. + +### [aero](https://github.com/juxt/aero/) + +A small library for explicit, intentful configuration. + +### [clojure.data.generators](https://github.com/clojure/data.generators) + +Random data generators + +### [honeysql](https://github.com/seancorfield/honeysql) + +Turn Clojure data structures into SQL + +### [bond](https://github.com/circleci/bond) + +Spying and stubbing library, primarily intended for tests. + +### [portal](https://github.com/djblue/portal/) + +A clojure tool to navigate through your data. This example will launch a browser to view your `deps.edn`: + +``` clojure +$ cat deps.edn | bb -cp `clojure -Spath -Sdeps '{:deps {djblue/portal {:mvn/version "0.4.1"}}}'` -m portal.main edn +``` + +### [version-clj](https://github.com/xsc/version-clj) + +Analysis and comparison of artifact version numbers. + +``` clojure +> export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {version-clj/version-clj {:mvn/version "0.1.2"}}}') +> bb --repl +... +user=> (require '[version-clj.core :as ver]) +nil +user=> (ver/version->seq "1.0.0-SNAPSHOT") +[(1 0 0) ["snapshot"]] +user=> (ver/version-compare "1.2.3" "1.0.0") +1 +user=> (ver/version-compare "1.0.0-SNAPSHOT" "1.0.0") +-1 +user=> (ver/version-compare "1.0" "1.0.0") +0 +``` + +## Pods + +[Babashka pods](https://github.com/babashka/babashka.pods) are programs that can +be used as Clojure libraries by babashka. + +- [babashka-sql-pods](https://github.com/babashka/babashka-sql-pods): pods for + interacting with SQL databases (PostgreSQL and HSQLDB). +- [bootleg](https://github.com/retrogradeorbit/bootleg): static HTML website + generation. +- [brisk](https://github.com/justone/brisk): Freeze and thaw with Nippy at the + command line. +- [clj-kondo](https://github.com/borkdude/clj-kondo/#babashka-pod): a Clojure + linter. +- [stash](https://github.com/rorokimdim/stash): encrypted text storage. +- [pod-babashka-filewatcher](https://github.com/babashka/pod-babashka-filewatcher): a + filewatcher pod based on Rust notify. +- [pod-babashka-lanterna](https://github.com/babashka/pod-babashka-lanterna): a + pod for making TUIs based on + [clojure-lanterna](https://github.com/babashka/clojure-lanterna). +- [pod-babashka-parcera](https://github.com/babashka/pod-babashka-parcera): pod around the parcera Clojure parser. +- [pod-janet-peg](https://github.com/sogaiu/pod-janet-peg): a pod for + calling [Janet](https://github.com/janet-lang/janet)'s PEG + functionality. +- [pod-jaydeesimon-jsoup](https://github.com/jaydeesimon/pod-jaydeesimon-jsoup): + a pod for parsing HTML using CSS queries backed by Jsoup. +- [pod-lispyclouds-docker](https://github.com/lispyclouds/pod-lispyclouds-docker): + A pod for interacting with docker. +- [pod-tzzh-aws](https://github.com/tzzh/pod-tzzh-aws): pod for interacting with AWS. +- [pod-tzzh-kafka](https://github.com/tzzh/pod-tzzh-kafka): pod for interacting with Kafka. +- [pod-tzzh-mail](https://github.com/tzzh/pod-tzzh-mail): pod for sending mail. +- [pod.xledger.sql-server](https://github.com/xledger/pod_sql_server): pod for interacting with SQL Server. +- [tabl](https://github.com/justone/tabl): Make tables from data in your terminal. + +## Projects + +### [babashka-test-action](https://github.com/marketplace/actions/babashka-test-action) + +Github Action to run clojure.test by Babashka. + +### [deps.clj](https://github.com/borkdude/deps.clj) + +A port of the [clojure](https://github.com/clojure/brew-install/) bash script to +Clojure / babashka. + +Also see [deps.clj documentation](../doc/deps.clj.md). + +### [4bb](https://github.com/porkostomus/4bb) + +4clojure as a babashka script! + +### [babashka lambda layer](https://github.com/dainiusjocas/babashka-lambda-layer) + +Babashka Lambda runtime packaged as a Lambda layer. + +### [Release on push Github action](https://github.com/rymndhng/release-on-push-action) + +Github Action to create a git tag + release when pushed to master. Written in +babashka. + +### [justone/bb-scripts](https://github.com/justone/bb-scripts) + +A collection of scripts developed by [@justone](https://github.com/justone). + +### [nativity](https://github.com/MnRA/nativity) + +Turn babashka scripts into binaries using GraalVM `native-image`. + +### [cldwalker/bb-clis](https://github.com/cldwalker/bb-clis) + +A collection of scripts developed by [@cldwalker](https://github.com/cldwalker). + +### [krell template](https://github.com/ampersanda/krell-template-runner) + +Babashka script for creating React Native (Krell) project + +### [wee-httpd](https://github.com/bherrmann7/bb-common/blob/master/wee_httpd.bb) + +A wee multi-threaded web server + +### [covid19-babashka](https://github.com/agrison/covid19-babashka) + +A babashka script to obtain covid-19 related information. + +### [bb-spotify](https://github.com/kolharsam/bb-spotify) + +Contol your spotify player using babashka. + +### [lambdaisland/open-source](https://github.com/lambdaisland/open-source) + +[Internal +tooling](https://github.com/borkdude/babashka/issues/457#issuecomment-636739415) +used by Lambda Island projects. Noteworthy: a [babashka-compatible hiccup +script](https://github.com/lambdaisland/open-source/blob/2cfde3dfb460e72f047bf94e6f5ec7f519c6d7a0/src/lioss/hiccup.clj). + +There's also +[subshell](https://github.com/lambdaisland/open-source/blob/master/src/lioss/subshell.clj) +which is like sh/sh, but it inherits stdin/stdout/stderr, so that the user sees +in real time what the subprocess is doing, and can possibly interact with +it. More like how shelling out in a bash script works. + +### [dharrigan/spotifyd-notification](https://github.com/dharrigan/spotifyd-notification) + +An example of using babashka to show spotifyd notifications via dunst. + +### [nextjournal/ssh-github-auth](https://github.com/nextjournal/ssh-github-auth) + +A babashka script which uses github auth to fetch SSH public keys. It can be useful to ensure only a certain team of people can access machines with SSH. + +### [turtlequeue/setup-babashka](https://github.com/turtlequeue/setup-babashka) + +Github Action to install Babashka in your workflows. Useful to run bb scripts in your CI. + +### [interdep](https://github.com/rejoice-cljc/interdep) + +Manage interdependent dependencies using Clojure's tools.deps and babashka. diff --git a/pods b/pods index e71ae00d..1417f30f 160000 --- a/pods +++ b/pods @@ -1 +1 @@ -Subproject commit e71ae00d032c2af9b1e218835107f243f0ab9049 +Subproject commit 1417f30fc4001cc9490b5f83c68630ea877d92d6