Fork me on GitHub
#babashka
<
2020-04-30
>
Felipe Cortez00:04:40

hi! I'm using clj-yaml but this is happening:

user=> (yaml/parse-string "a: 1")       
#ordered/map ([:a 1])
user=> (type *1)
flatland.ordered.map.OrderedMap
user=> (flatland.ordered.map/ordered-map :a 1)
clojure.lang.ExceptionInfo: Could not resolve symbol: flatland.ordered.map/ordered-map [at line 15, column 2]
it does work in clj with clj-yaml in deps.edn

borkdude06:04:29

@clojurians884 makes sense because flatland ordered is not exposed. Why do you need that API? Can you give an example program where it would be useful? You can do (into {} the-ordered-map) btw

Felipe Cortez12:04:24

yeah, it seems like using Clojure's maps is enough for what I need. thanks!

borkdude11:04:50

Evaluation criteria for adding libraries and classes to babashka: https://github.com/borkdude/babashka/blob/master/doc/dev.md#adding-libraries-and-classes. What do you think?

👍 4
sogaiu13:04:01

sounds like a good starting point

nate14:04:51

This looks great. Good to have criteria.

lukasz14:04:00

This is great!

nate14:04:16

Was looking through the source this morning and came across this: https://github.com/borkdude/babashka/blob/master/src/babashka/impl/features.clj

nate14:04:41

Nice succinct place to see what is enabled and disabled by default.

nate14:04:33

Also, I'm impressed at the engineering that makes this all work. Kudos.

nate14:04:13

Also wondering at what point the compile script will turn into a bb script. 🙂

borkdude14:04:58

Probably never, because that assumes you already have a bb which is not realistic for someone who wants to build from source. And thanks.

borkdude14:04:33

I want to document all the feature flags in build.md when I'm done with this

nate14:04:13

Oh yeah, good point about not having bb. Totally forgot that some people might not have it yet.

nate14:04:27

Cool, it's heading in a great direction.

borkdude14:04:02

yeah, also in build environments, you can't really expect bb to be there, and then you would have to depend on Github releases to get one, etc., it's not that great to rely on too many things

borkdude14:04:46

do the defaults make sense to you, or should we leave one other out? 😉

nate14:04:48

The defaults look great. They line up with the criteria.

Darin Douglass14:04:47

yeah they feel good to me. i think this is a good middle-ground for everyone

borkdude14:04:10

I was having doubts about core.async maybe, but I also don't want to break existing scripts.

Darin Douglass14:04:17

i'll resurrect my psql parsing code and make a small lib for those that don't want to build their own exe

borkdude14:04:33

that's cool. and if you want, you can still compile your own with postgres support

Darin Douglass14:04:49

i'll be doing that definitely

nate14:04:37

I think core async adds a nice bit around threads. I haven't used it in bb yet, just did a bunch of future calls.

Darin Douglass14:04:12

yeah keeping async in makes sense to me. in bash you have & for background jobs, same in babashka with core.async

borkdude14:04:13

yeah, I'll just keep it, it's way too late now to remove it anyway

nate16:04:41

random thought on feature flags, how about including what features are compiled in when showing babashka's version?

💯 4
nate16:04:15

vim does this in its help

💯 4
nate16:04:49

useful if I find something isn't working and I want to see what is supported

borkdude17:04:12

would it maybe be better to have a --describe option that outputs a chunk of EDN with the version and all the features, and possible other stuff as well, so it's also parseable by other Clojure programs?

borkdude17:04:42

similar to clojure -Sdescribe

nate17:04:07

woah, TIL about clojure -Sdescribe

nate17:04:16

I think edn chunk sounds great!

borkdude21:04:13

$ ./bb --describe
{:babashka/version   "0.0.90-SNAPSHOT"
 :feature/core-async true
 :feature/csv        true
 :feature/java-nio   true
 :feature/java-time  true
 :feature/xml        true
 :feature/yaml       true
 :feature/jdbc       false
 :feature/postgresql false
 :feature/hsqldb     false}

👍 12
nate21:04:27

this looks awesome!

lilactown21:04:43

I’m trying to run (clojure.java.shell/sh "keytool" ,,,) but it’s not waiting for me to type into stdin for a password - any tips?

lilactown21:04:59

some other commands I shell out to, do wait for me to type in a password

borkdude21:04:57

@lilactown Maybe you can use the :in option?

$ bb '(shell/sh "cat" :in "foo")'
{:exit 0, :out "foo", :err ""}
or do you really want to type something interactively?

lilactown22:04:06

yeah I’m trying the :in and it’s working okay

lilactown22:04:15

it’s variable sometimes how many times it asks for the password

borkdude22:04:07

if clojure.java.shell doesn't work, you might also be able to use ProcessBuilder: https://github.com/borkdude/babashka/issues/299

borkdude22:04:36

it has an input and outputstream you can write/read from

borkdude22:04:00

@lilactown Interactive program:

$ bb '
(let [program ["bash" "-c"
               "echo \"type something!\"; read input; echo \"you typed: $input\""]
      pb (doto (ProcessBuilder. program)
           (.inheritIO))
      p (.start pb)]
  (.waitFor p) nil)'
type something!
1
you typed: 1

👍 4
👀 4