Comments (14)
@saikyun You can print output on multiple lines using -o
:
ls -la | bb -io '(map #(apply str (drop 10 %)) *in*)'
from babashka.
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.
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.
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.
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.
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.
@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.
@saikyun Thanks for using babashka btw. Maybe you have some thoughts about this issue? #48
from babashka.
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.
@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.
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.
@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.
@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.
Can confrim fipp works great with babashka. https://github.com/brandonbloom/fipp
from babashka.
Related Issues (20)
- Cannot import `shadow.css.build` HOT 5
- eximia compatibility
- empty bb.edn blowup babashka
- Unable to resolve classname: java.time.temporal.WeekFields HOT 2
- #{a b} set initialization doesn't throw if there are duplicates (in clj it does) HOT 6
- Command line parameters not being parsed by scripts, passing right through if Babashka has the same ones. HOT 2
- Change in v1.3.187 release breaks use of the `version` literal as an input to scripts
- Caching issue with relative local/root by same name, used in bb.edn in different directories HOT 1
- Resolve bb.edn when script is invoked via symlink HOT 1
- No dispatch macro for: ? HOT 9
- metadata added by read-string (as compared to clj implementation). HOT 9
- Embedding META-INF/bb.edn with :deps results in: Cannot run program "java"
- bb execution fails on Gentoo HOT 6
- Adding javax.net.ssl.SSLSocket and javax.net.ssl.SSLSocketFactory? HOT 33
- Static-linked binary file for armv7(32-bit) platform. HOT 1
- hash-ordered-coll not found in clojure.core HOT 1
- Try to support latest changes in at-at
- Wrapping built-in timbre/log! throws an error HOT 3
- exec-task description
- bb --version could run without a JVM HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from babashka.