improve -h
This commit is contained in:
parent
22aa6ba39b
commit
58dade9351
1 changed files with 14 additions and 2 deletions
|
@ -40,7 +40,7 @@
|
||||||
[config config?]
|
[config config?]
|
||||||
(:transform config))
|
(:transform config))
|
||||||
|
|
||||||
(defn -main [{:keys [options config-location] :as args}]
|
(defn transform! [config-location]
|
||||||
(let [config (infra/load-config config-location)
|
(let [config (infra/load-config config-location)
|
||||||
mastodon-auth (mastodon-auth config)]
|
mastodon-auth (mastodon-auth config)]
|
||||||
(masto/get-mastodon-timeline
|
(masto/get-mastodon-timeline
|
||||||
|
@ -85,7 +85,19 @@
|
||||||
(if (= ::s/invalid parsed-args)
|
(if (= ::s/invalid parsed-args)
|
||||||
(do (s/explain ::args args)
|
(do (s/explain ::args args)
|
||||||
(infra/exit-with-error "Bad commandline arguments"))
|
(infra/exit-with-error "Bad commandline arguments"))
|
||||||
(-main parsed-args))))
|
(let [{:keys [options config-location]} parsed-args]
|
||||||
|
(cond
|
||||||
|
(some #(= "-h" %) options)
|
||||||
|
(print "usage:
|
||||||
|
|
||||||
|
node target/mastodon-bot.js [-h] /path/to/config.edn
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
npm start [-h] /path/to/config.edn
|
||||||
|
")
|
||||||
|
:default
|
||||||
|
(transform! config-location))))))
|
||||||
|
|
||||||
(st/instrument 'mastodon-auth)
|
(st/instrument 'mastodon-auth)
|
||||||
(st/instrument 'twitter-auth)
|
(st/instrument 'twitter-auth)
|
||||||
|
|
Reference in a new issue