l3nz / cli-matic

Compact, hands-free [sub]command line parsing library for Clojure.
Eclipse Public License 2.0
360 stars 28 forks source link

[Ftr] Babashka: avoid external bb.edn file #148

Closed l3nz closed 2 years ago

l3nz commented 2 years ago

Is your feature request related to a problem? Please describe.

Our example for Babashka requires an external bb.edn file. For a script, it's two files - the script itself and bb.edn. See https://github.com/l3nz/cli-matic/tree/master/examples/bb

Describe the solution you'd like

Can we embed bb.edn the script itself? e.g. on the shell call? Maybe @borkdude knows 😸

Describe alternatives you've considered

Having cli-matic, at this point, embedded directly into Babashka, so no external deps at all.

borkdude commented 2 years ago

You can do that as follows:

(ns cli-matic)

(require '[babashka.deps :as deps])

(deps/add-deps '{:deps {org.babashka/spec.alpha {:git/url "https://github.com/babashka/spec.alpha"
                                                 :sha "1a841c4cc1d4f6dab7505a98ed2d532dd9d56b78"}
                        cli-matic/cli-matic {:mvn/version "0.5.2"}}})

(require '[cli-matic.core :as cli])

;; ...
l3nz commented 2 years ago

Thanks @borkdude works like a charm.