This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-31
Channels
- # announcements (1)
- # aws (4)
- # babashka (40)
- # beginners (89)
- # calva (13)
- # cider (3)
- # clj-kondo (36)
- # cljdoc (16)
- # clojure (74)
- # clojure-boston (1)
- # clojure-dev (7)
- # clojure-europe (30)
- # clojure-new-zealand (1)
- # clojure-nl (17)
- # clojure-uk (5)
- # clojurescript (16)
- # core-async (9)
- # cursive (16)
- # datahike (3)
- # datalog (6)
- # datascript (7)
- # datomic (15)
- # emacs (38)
- # events (2)
- # figwheel-main (3)
- # fulcro (6)
- # google-cloud (18)
- # graalvm (6)
- # gratitude (1)
- # honeysql (1)
- # introduce-yourself (1)
- # jobs (1)
- # leiningen (5)
- # lsp (6)
- # malli (11)
- # meander (2)
- # off-topic (4)
- # re-frame (6)
- # reitit (8)
- # releases (2)
- # remote-jobs (3)
- # reveal (4)
- # shadow-cljs (200)
- # sql (8)
- # tools-deps (16)
Hello everyone, how would I go about removing a tagged literal that comes with the output of babashka.fs functions? I want to write my list of files in an edn but I have hit a blocker with extending my reader to recognise #object[sun.nio.fs.UnixPath
. I am not familiar with tagged literals and the reader itself, I can do without them for now, I just need the raw paths to the files.
I ran into a strange behavior, I have to be missing something obvious here. Why am I always running the truthy path?
(let [[output-dir container-name inside-container?] *command-line-args*]
(when (or (empty? output-dir) (empty? container-name))
(System/exit 1))
(if (true? (boolean inside-container?))
(println "truthy with these args: " inside-container? )
(println "falsy")))
I'd always get truthy with these args: true
or truthy with these args: false
regardless of what I supply as my third argument. Can't reach the falsy path 😞@krishanvj boolean
converts a truthy value into true
. Only nil
and false
are non-truthy values. A string is always a truthy value.
Just went with the parse-boolean function, is this part of Clojure or only found within babashka for this exact use-case? Thank btw!
to prep our CI agents, I need to run a bb.edn file in order for the deps.clj packages be downloaded in the CI user dir. Is there an easier way to “prep” a user for future use of bb?
Trying to make an ISO-8601 formatter for AWS. Unfortunately this is giving me my offset time instead of GMT. What am I missing?
(def ISO-8601 (DateTimeFormatter/ofPattern "yyyyMMdd'T'HHmmss'Z'"))
(.format (LocalDateTime/now) ISO-8601)
;; => "20220131T121126Z" (should be GMT, not UTC-8?)
Oops, it's probably not. I posted here because I was going off your SO example for babashka. Can move to a different channel 😅
Ok, I can try that and set the zone to GMT. I'm just confused because I didn't want a zone at all, and I thought LocalDateTime didn't have that, so I'm wondering how it is even getting my local timezone at all
I think it just appends whatever you put in your format string:
user=> (def ISO-8601 (java.time.format.DateTimeFormatter/ofPattern "yyyyMMdd'T'HHmmss'Zxxx'"))
#'user/ISO-8601
user=> (.format (java.time.LocalDateTime/now) ISO-8601)
"20220131T212352Zxxx"
user=> (-> (java.time.ZonedDateTime/now) (.format java.time.format.DateTimeFormatter/ISO_INSTANT))
"2022-01-31T20:26:29.232494Z"
Is this the right one?
user=> (def ISO-8601 (java.time.format.DateTimeFormatter/ofPattern "yyyyMMdd'T'HHmmss'Z'"))
#'user/ISO-8601
user=> (-> (java.time.ZonedDateTime/now) (.format ISO-8601))
"20220131T212950Z"
Or maybe this one:
user=> (-> (java.time.ZonedDateTime/now java.time.ZoneOffset/UTC ) (.format ISO-8601))
"20220131T203047Z"
A question about getting output from a babashka process: I have a subprocess that needs to print things to stdout, but it produces a value I want to get back. What’s a good way to get the value back out of it? I am considering passing a file path, and watching the file path from the caller… is this such a good idea though? 😅
so it would look like:
(-> (babashka.process/process ["foo"] {:err :string :inherit true}) deref :err)
Cool! Honestly I would do it the other way around, send questions over stderr and send data over stdout, but inquirer JS might already send over stdout, so then that's not an option
stderr is usually for warnings, side information, stdout is the real data you want from a program
the thing is, inquirer doesn’t work very well when speaking in stderr, missing colors etc