From 43a1634d3b7debdb4e13b53239983df8afde009e Mon Sep 17 00:00:00 2001 From: Lee Read Date: Wed, 9 Sep 2020 14:25:38 -0400 Subject: [PATCH] Document version-clj as a library that works with babashka (#568) * Document version-clj as a library that works with babashka The `use` syntax relies on resolution of #565 * Switch to loading version-clj via require In bb version <= 0.2.0 `use` does not work with `version-clj.core`, so the example now provides usage that works with older versions of bb. --- doc/libraries.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/doc/libraries.md b/doc/libraries.md index 00a06a9e..04a8f4a0 100644 --- a/doc/libraries.md +++ b/doc/libraries.md @@ -261,6 +261,26 @@ A clojure tool to navigate through your data. This example will launch a browser $ 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