Add version command line arg
Requires "project.clj" to be added in resource-path
This commit is contained in:
parent
220aef9d5c
commit
4cbaac8d25
2 changed files with 6 additions and 2 deletions
|
@ -12,7 +12,8 @@
|
||||||
:target-path "target/%s/"
|
:target-path "target/%s/"
|
||||||
:source-paths ["src/main/cljc"
|
:source-paths ["src/main/cljc"
|
||||||
"src/main/clj"]
|
"src/main/clj"]
|
||||||
:resource-paths ["src/main/resources"]
|
:resource-paths ["src/main/resources"
|
||||||
|
"project.clj"]
|
||||||
:repositories [["snapshots" :clojars]
|
:repositories [["snapshots" :clojars]
|
||||||
["releases" :clojars]]
|
["releases" :clojars]]
|
||||||
:deploy-repositories [["snapshots" {:sign-releases false :url "https://clojars.org/repo"}]
|
:deploy-repositories [["snapshots" {:sign-releases false :url "https://clojars.org/repo"}]
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
[clojure.spec.alpha :as s]
|
[clojure.spec.alpha :as s]
|
||||||
[clojure.string :as cs]
|
[clojure.string :as cs]
|
||||||
[clojure.tools.reader.edn :as edn]
|
[clojure.tools.reader.edn :as edn]
|
||||||
|
[clojure.java.io :as io]
|
||||||
[dda.c4k-common.yaml :as yaml]
|
[dda.c4k-common.yaml :as yaml]
|
||||||
[dda.c4k-common.common :as cm]
|
[dda.c4k-common.common :as cm]
|
||||||
[dda.c4k-common.core :as core]
|
[dda.c4k-common.core :as core]
|
||||||
|
@ -15,7 +16,7 @@
|
||||||
|
|
||||||
" name " {your configuraton file} {your authorization file}"))
|
" name " {your configuraton file} {your authorization file}"))
|
||||||
|
|
||||||
(s/def ::options (s/* #{"-h"}))
|
(s/def ::options (s/* #{"-h" "-v" "--version"}))
|
||||||
(s/def ::filename (s/and string?
|
(s/def ::filename (s/and string?
|
||||||
#(not (cs/starts-with? % "-"))))
|
#(not (cs/starts-with? % "-"))))
|
||||||
(s/def ::cmd-args (s/cat :options ::options
|
(s/def ::cmd-args (s/cat :options ::options
|
||||||
|
@ -37,6 +38,8 @@
|
||||||
(cond
|
(cond
|
||||||
(some #(= "-h" %) options)
|
(some #(= "-h" %) options)
|
||||||
(println (usage name))
|
(println (usage name))
|
||||||
|
(some #(or (= "-v" %) (= "--version" %)) options)
|
||||||
|
(println (some-> (io/resource "project.clj") slurp edn/read-string (nth 2)))
|
||||||
:else
|
:else
|
||||||
(let [config-str (slurp config)
|
(let [config-str (slurp config)
|
||||||
auth-str (slurp auth)
|
auth-str (slurp auth)
|
||||||
|
|
Loading…
Reference in a new issue