This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-05-31
Channels
- # announcements (1)
- # babashka (27)
- # beginners (33)
- # cider (22)
- # clj-kondo (1)
- # cljdoc (2)
- # cljs-dev (8)
- # clojure (96)
- # clojure-australia (7)
- # clojure-europe (24)
- # clojure-nl (1)
- # clojure-taiwan (1)
- # clojure-uk (7)
- # clojuredesign-podcast (4)
- # clojurescript (23)
- # clojureverse-ops (1)
- # conjure (11)
- # cursive (29)
- # datahike (1)
- # datascript (8)
- # datomic (4)
- # emacs (1)
- # figwheel-main (1)
- # fulcro (3)
- # helix (7)
- # jobs (4)
- # lsp (6)
- # malli (3)
- # off-topic (35)
- # pathom (6)
- # re-frame (4)
- # releases (1)
- # sci (18)
- # shadow-cljs (14)
- # sql (1)
- # tools-deps (11)
- # xtdb (6)
Hi everyone, first time poster. I'm trying to use tools.cli from within a babashka script. So I'm not sure if my question should be oriented there or here but here it goes
I've triedĀ `:validate`Ā andĀ `:validate-fn`Ā but they don't seem to be invoked for the value specified by theĀ `:default`Ā key (which as was suggested was ::missing
and the :validate
fn was :validate [(fn [x] (println "XXXXX:" x) (not= ::missing)) "Missing required option: --gitlab-token"]
@nicolas.estrada938 You could just do (assert (:required (:options parsed)) "required is required")
oh ok... that's all I needed to know š Thanks! I do feel that tools.cli could benefit with a :mandatory
flag the way https://github.com/grammarly/omniconf does (too bad it doesn't work with babashka š
)
I think required options are contextual so it depends on how you invoked the tool. E.g. tool --help
doesn't require any other options, but tool --foo
might
Where does omniconf fail? We could look to make it work with bb if it's within reasonable distance. Let's talk in #babashka