Fork me on GitHub
#babashka
<
2020-04-29
>
teodorlu10:04:41

I got a pleasant flash of a future where we pipe bb scripts with semantic, well-understood EDN sequences instead of plaintext https://twitter.com/jackrusher/status/1255405238586048512

bherrmann12:04:06

Humm.... on Ubuntu 19.10 I tried babashka-0.0.89-linux-amd64.zip and babashka-0.0.89-linux-static-amd64.zip - both throw execptions and exit when used with "--nrepl-server"

Exception in thread "main" java.lang.NullPointerException
	at clojure.string$starts_with_QMARK_.invokeStatic(string.clj:364)
	at babashka.main$parse_opts$fn__15702.invoke(main.clj:130)

borkdude12:04:15

@bherrmann Thanks for the error report. I noticed now that this does work: bb --nrepl-server 1667

borkdude12:04:29

I'll fix it in the next release.

bherrmann12:04:06

oh.. I'd always left that argument off. Thanks!

bherrmann12:04:47

FYI: I'm using the newly exposed clojure.pprint/print-table to extract and display data from the mysql command line. (just in case anyone else is noodling with mysql)

(def table-as-str (:out (shell/sh "mysql" "-udba" "-pdba" "corp" "--column-names" "-e" "select * from company_settings_nodes limit 2")))
(def table-as-lines (str/split-lines table-as-str))
(def table-headers (str/split (first table-as-lines) #"\t"))
(def table-as-maps (map #(zipmap table-headers (str/split %1 #"\t")) (rest table-as-lines)))

(clojure.pprint/print-table table-headers table-as-maps)

| id | parent_node_id |     short_name | value_data_type | is_value_optional |            title | description | node_type |
|----+----------------+----------------+-----------------+-------------------+------------------+-------------+-----------|
|  1 |           NULL |         orders |            NULL |                 0 |           Orders |        NULL |  CATEGORY |
|  2 |              1 | orders.packing |            NULL |                 0 | Packing Services |        NULL |  CATEGORY |

borkdude13:04:10

@bherrmann That's really awesome. Feel free to add to examples/ and doc/examples.md.

borkdude14:04:55

@bherrmann I made an issue here, but I think I tagged the wrong guy: https://github.com/borkdude/babashka/issues/396

bherrmann14:04:15

ok, yea in gitland I'm bherrmann7... PR is https://github.com/borkdude/babashka/pull/399