This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-01-18
Channels
- # announcements (19)
- # babashka (30)
- # beginners (51)
- # biff (12)
- # calva (20)
- # cider (27)
- # clara (20)
- # clj-kondo (19)
- # clojure (128)
- # clojure-canada (1)
- # clojure-dev (5)
- # clojure-europe (29)
- # clojure-nl (1)
- # clojure-norway (48)
- # clojure-uk (5)
- # clojurescript (6)
- # clr (37)
- # core-async (17)
- # cursive (2)
- # data-oriented-programming (2)
- # datahike (1)
- # datomic (5)
- # emacs (22)
- # exercism (1)
- # funcool (17)
- # humbleui (15)
- # jobs (1)
- # malli (44)
- # off-topic (11)
- # podcasts-discuss (1)
- # pomegranate (1)
- # react (1)
- # remote-jobs (1)
- # shadow-cljs (25)
- # tools-build (12)
- # tools-deps (70)
- # xtdb (24)
what is the nicest way to read a json, transform a val and spit back? I was thinking about a shell oneliner
e.g.:
$ echo "{\"a\": 1}" | bb -e "(-> (json/parse-string (slurp *in*) true) :a (json/generate-string))"
"1"
https://github.com/antonmedv/fx if you need some TUI
Hmh, how do I specify a default list of items to babashka.cli so that it does not append the ones from the argument list but replace them? In spec
. Should I use the :exec-args
instead in that case and not :default
and :default-desc
👀 2
Both ways seem to append, what am I doing wrong
➜ frontend git:(enhancement/hierarchial-system-diagram) ✗ bb scripts/transpile-device-graph.bb
[CS2-GHS GHS-250 GHS-1000]
➜ frontend git:(enhancement/hierarchial-system-diagram) ✗ bb scripts/transpile-device-graph.bb -s CS2-GHS
[CS2-GHS GHS-250 GHS-1000 CS2-GHS]
(def small-spec {:systems {:ref "<name or names>"
:alias :s
:coerce []
:desc "To include only a selected set of systems, provide their names."}})
(let [{:keys [systems]} (cli/parse-opts *command-line-args* {:spec small-spec :error-fn error-fn :exec-args {:systems ["CS2-GHS" "GHS-250" "GHS-1000"]}})]
(println systems))
same output as above
Should've that worked?
Do you use GH for those?
Yes, I don't do JIRA ;) https://github.com/babashka/cli
https://github.com/babashka/cli/issues/56 there. Thanks!
For now I just did
(if (> (count systems) (count default-systems))
(subvec systems (count default-systems))
systems)
and continue my life happily 🙂