first steps with bb
This commit is contained in:
parent
e96581754c
commit
52db785f8b
4 changed files with 28 additions and 0 deletions
2
bb.edn
Normal file
2
bb.edn
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
{:deps {dda/dda-devops-build {:local/root "."}}}
|
||||||
|
|
6
dda-devops-build.sh
Executable file
6
dda-devops-build.sh
Executable file
|
@ -0,0 +1,6 @@
|
||||||
|
#!/usr/bin/env bb
|
||||||
|
|
||||||
|
(require '[dda.devops-build.main :as build])
|
||||||
|
|
||||||
|
(when (= *file* (System/getProperty "babashka.file"))
|
||||||
|
(apply build/-main *command-line-args*))
|
3
deps.edn
Normal file
3
deps.edn
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{:paths ["src/main/clj"]
|
||||||
|
:deps {org.clojure/spec.alpha {:mvn/version "0.4.233"}
|
||||||
|
orchestra {:mvn/version "2021.01.01-1"}}}
|
17
src/main/clj/dda/devops_build/main.clj
Normal file
17
src/main/clj/dda/devops_build/main.clj
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
(ns dda.devops-build.main)
|
||||||
|
(require '[clojure.spec.alpha :as s])
|
||||||
|
|
||||||
|
(s/def ::options (s/* #{"-h"}))
|
||||||
|
(s/def ::cmd-args (s/cat :options ::options
|
||||||
|
:args any?))
|
||||||
|
|
||||||
|
(defn invalid-args-msg
|
||||||
|
[spec args]
|
||||||
|
(s/explain spec args)
|
||||||
|
(println (str "Bad commandline arguments\n")))
|
||||||
|
|
||||||
|
(defn -main [& cmd-args]
|
||||||
|
(let [parsed-args-cmd (s/conform ::cmd-args cmd-args)]
|
||||||
|
(if (= ::s/invalid parsed-args-cmd)
|
||||||
|
(invalid-args-msg ::cmd-args cmd-args)
|
||||||
|
(println parsed-args-cmd))))
|
Loading…
Reference in a new issue