Fork me on GitHub
#babashka
<
2022-10-24
>
steveb8n02:10:57

Q: is there a bb compatible lib for colorized pprint? something like aviso/pretty?

borkdude06:10:50

Well, have you tried aviso pretty?

steveb8n08:10:16

no but I will now 🙂

Daniel Gerson08:10:07

@U0510KXTU I used zprint which was pretty good for my needs.

steveb8n08:10:46

tried loading aviso but got the following from the require…

steveb8n08:10:49

----- Error --------------------------------------------------------------------
Type:     clojure.lang.ExceptionInfo
Message:  Could not resolve symbol: Thread$UncaughtExceptionHandler
Data:     {:type :sci/error, :line nil, :column nil, :file "io/aviso/repl.clj", :phase "analysis"}
Location: io/aviso/repl.clj:34:3
Phase:    analysis

----- Context ------------------------------------------------------------------
30: (defn uncaught-exception-handler
31:   "Returns a reified UncaughtExceptionHandler that prints the formatted exception to `*err*`."
32:   {:added "0.1.18"}
33:   []
34:   (reify Thread$UncaughtExceptionHandler
      ^--- Could not resolve symbol: Thread$UncaughtExceptionHandler
35:     (uncaughtException [_ _ t]
36:       (binding [*out* *err*]
37:         (printf "Uncaught exception in thread %s:%n%s%n"
38:                 (-> (Thread/currentThread) .getName)
39:                 (e/format-exception t))

----- Stack trace --------------------------------------------------------------
clojure.core/reify*                       - <built-in>
io.aviso.repl/reify                       - io/aviso/repl.clj:34:3
io.aviso.repl                             - io/aviso/repl.clj:34:3
clojure.core/reify                        - <built-in>
io.aviso.repl                             - io/aviso/repl.clj:34:3
io.aviso.repl                             - io/aviso/repl.clj:30:1
tasks                                     - /Users/steve/Documents/oss/salesforce-babashka/src/tasks.clj:2:3
tasks-tests                               - /Users/steve/Documents/oss/salesforce-babashka/test/tasks_tests.clj:2:3
user-ee0b5681-7624-4ad5-8672-e3926af017f3 - <expr>:4:47

steveb8n08:10:42

@U03B2SRNYTY does zprint include coloring?

steveb8n08:10:09

I’ll give it a try

👍 1
Daniel Gerson08:10:33

Tip, you won't see some syntax like "..." if you use a light scheme on a black terminal etc.

steveb8n08:10:39

thanks. working well in initial tests. I’ll try to tweak the theme to see a bit less red

partyparrot 1
Daniel Gerson08:10:13

Heed my tip before you start changing colours.

🙏 1
borkdude08:10:52

That namespace is about colors, you don't need the rest if you just want colors

borkdude08:10:32

if something is missing in the toolbox, please create PRs :)

steveb8n09:10:06

Thanks. Zprint will do the job for now

👍 1
Daniel Gerson12:10:54

Nice name 😉

borkdude10:10:46

Small tip, with the recent babashka, it's possible to pass an -Sdeps flag to merge in extra settings like :mvn/local-repo :

$ bb -Sdeps '{:mvn/local-repo "mvn2" :deps {medley/medley {:mvn/version "1.4.0"}}}'
$ ls mvn2
medley org

👏 1
👍 1
dabrazhe15:10:54

How can run 'switch' to a certain folder with java shell before running another shell command in bb?

borkdude15:10:15

java shell?

dabrazhe15:10:58

clojure.java.shell ie not bb shell

borkdude15:10:23

aha.

(clojure.java.shell/sh "ls" :dir "..")
I think

👍 1
dabrazhe15:10:45

Yes, that's the one, thank you

dabrazhe15:10:18

Same in babashka.shell? : )

borkdude15:10:39

(babashka.process/shell {:dir ".."} "ls")

👍 1