l3nz / cli-matic

Compact, hands-free [sub]command line parsing library for Clojure.
Eclipse Public License 2.0
361 stars 29 forks source link

Printing on STDERR in Planck #111

Closed l3nz closed 4 years ago

l3nz commented 4 years ago

version

0.4.0, CLJS

problem

It would be great if we were to print everything on STDERR in Planck too afte the changs made for bug #100 - I made the changes to the platforms namespace, but I was not able to print our own messages to STDERR.

expected behavior

         ./toycalc.cljs 2> /dev/null

should not output anything.

l3nz commented 4 years ago

See https://github.com/l3nz/cli-matic/blob/6c3f46b429da93754ad3d6fc455fbeb90012cba7/src/cli_matic/platform.cljs#L109

mfikes commented 4 years ago

I think this might work:

(defn printError [o]
   (binding [*print-fn* *print-err-fn*]
     (println o)))
l3nz commented 4 years ago

Thanks @mfikes - works like a charm!