Giter Club home page Giter Club logo

Comments (14)

borkdude avatar borkdude commented on May 11, 2024 2

@saikyun You can print output on multiple lines using -o:

ls -la | bb -io '(map #(apply str (drop 10 %)) *in*)'

from babashka.

borkdude avatar borkdude commented on May 11, 2024 1

I'm in favor of this idea, but I might go for fipp or some other pretty printer, since that works well with GraalVM. I haven't been able to use clojure.pprint (unchanged) with GraalVM.

from babashka.

saikyun avatar saikyun commented on May 11, 2024

Ah, all right. I came up with some more context:
One issue I have atm is that if I have a collection of lines (e.g. (= *in* '("a", "b", "c")), I can't really come up with a good way to print them nicely. If I just return them it can get unwieldy, and I can't use doseq nor doall, so I don't know how to run println multiple times either.

from babashka.

saikyun avatar saikyun commented on May 11, 2024

Here's an example: ls -la | bb -i '(map #(apply str (drop 10 %)) *in*)'
If we imagine that ls -la is log information or similar, where each line is too wide for the screen, I'd want to cut off the first 10 letters, then print all the lines as ls -la would. :)

from babashka.

saikyun avatar saikyun commented on May 11, 2024

It'd also be pretty cool if a pretty printer (whichever you decide upon) could be used as default for all output data. Maybe it's too performance heavy though, so maybe it could be a flag or such.

from babashka.

saikyun avatar saikyun commented on May 11, 2024

Awesome, thanks! This actually solves a lot of problems. :D

Just some feedback, I didn't quite understand this -o: write lines to stdout. Not sure what it could say instead, maybe -o: on multiple elements, prints each element on a new line or similar... :)

from babashka.

borkdude avatar borkdude commented on May 11, 2024

@saikyun Thanks for the feedback, I'll think about a better way to describe that option. It also works for a single string btw.

from babashka.

borkdude avatar borkdude commented on May 11, 2024

@saikyun Thanks for using babashka btw. Maybe you have some thoughts about this issue? #48

from babashka.

borkdude avatar borkdude commented on May 11, 2024

Since you can already pprint with jet I'm closing this for now.

$ bb '(range 30)' | jet --pretty
(0
 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29)

from babashka.

saikyun avatar saikyun commented on May 11, 2024

@borkdude I'm happy to try it out. :) I enjoy being able to use clojure in more places.
Ah, didn't know about jet, that's great to know.
It seems like you've already made some decisions wrt #48. I don't know much about spawning processes, so I'd have to play around with it.

from babashka.

lvh avatar lvh commented on May 11, 2024

FWIW one downside to this resolution is that e.g. taoensso.timbre doesn't work (transitive dependency on https://github.com/AvisoNovate/pretty/blob/master/src/io/aviso/exception.clj which in turn specifically wants clojure.pprint).

from babashka.

borkdude avatar borkdude commented on May 11, 2024

@lvh I'm not sure what you are referring to, but the latest babashka is now based on clojure.pprint proper. See issue #571. What problem are you seeing with 0.2.3?

from babashka.

borkdude avatar borkdude commented on May 11, 2024

@lvh Oh I see. That namespace uses pp/simple-dispatch which is currently not exposed in bb. Let's make a different issue for that and fix it.

from babashka.

sirmspencer avatar sirmspencer commented on May 11, 2024

Can confrim fipp works great with babashka. https://github.com/brandonbloom/fipp

from babashka.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.