first steps for uberjar

This commit is contained in:
jem 2021-03-05 16:28:25 +01:00
parent 377c3fa824
commit d869ca7eee
2 changed files with 22 additions and 15 deletions

22
src/main/clj/uberjar.clj Normal file
View file

@ -0,0 +1,22 @@
(ns dda.k8s-mastodon-bot.uberjar
(:require
[clojure.spec.alpha :as s]
[dda.k8s-mastodon-bot.core :as core])
(def usage
"usage:
k8s-mastodon-bot {your configuraton} {your authorization}")
(defn main [& args]
(let [parsed-args (s/conform ::core/args args)]
(if (= ::s/invalid parsed-args)
(do (s/explain ::core/args args)
(print (str "Bad commandline arguments\n" usage)))
(let [{:keys [options config auth]} parsed-args]
(cond
(some #(= "-h" %) options)
(print usage)
:default
(generate config auth))))))

View file

@ -25,19 +25,4 @@
(defn generate [my-config my-auth] (defn generate [my-config my-auth]
(yaml/to-string (generate-config my-config my-auth))) (yaml/to-string (generate-config my-config my-auth)))
(def usage
"usage:
k8s-mastodon-bot {your configuraton} {your authorization}")
(defn main [& args]
(let [parsed-args (s/conform ::args args)]
(if (= ::s/invalid parsed-args)
(do (s/explain ::args args)
(print (str "Bad commandline arguments\n" usage)))
(let [{:keys [options config auth]} parsed-args]
(cond
(some #(= "-h" %) options)
(print usage)
:default
(generate config auth))))))