Comments (8)
Thanks for the suggestion!
I think let's start with --color=off
--color=auto
(default) --color=on
with shorthands -c
for on and -C
for off
off = puget/pprint
on = puget/cprint
auto = on (later we can add tty detection)
happy for a PR on this @Macroz
from cq.
So maybe don't force puget/cprint
here but use ppt/pprint
or puget/pprint
? https://github.com/markus-wa/cq/blob/main/src/cq/formats.clj#L42
Since this repo is in Hacktoberfest I could be interested in doing a PR on this.
from cq.
implemented in the latest release - thanks @Macroz https://github.com/markus-wa/cq/releases/tag/2022.10.12-14.51.05
from cq.
pretty was released with automatic logic for enabling colors. Seems pretty straightforward: clj-commons/pretty@7cb0c16
from cq.
Thanks @hukka - I've created #18 to support this.
PRs welcome as I probably won't get to this for a while
from cq.
So I implemented #18 as described, but I'm not sure this logic (from pretty
) works as desired.
The code detects if you are in a TTY alright, but if you don't pipe to a file but to your terminal (e.g., for one-off manual use and exploration), you probably want to see the colors. You are likely also not in a REPL. So this kind of detection would mean the default is uncolored, and you must force the colors with a flag pretty much always.
Any more ideas?
from cq.
Thanks @Macroz - I think that's as good as it gets.
As far as I'm aware there is no way to differentiate between pipe to command vs pipe to file (also, commands like tee
may write to both a file and to TTY).
It's preferrable to break colouring vs breaking pipe to file.
Would you be able to open a PR? 😄
from cq.
Right!
How about this for a PR #20?
from cq.
Related Issues (8)
- Create a homebrew-brew repository HOT 2
- transit+msgpack only works on the JVM HOT 2
- --color=auto should detect if output supports colors HOT 5
- `-i json` fails with given examples HOT 2
- make `clojure.instant`, or some other string ⇔ date/time library, available (or provide examples.) HOT 2
- Provide binaries for various architectures HOT 1
- Add colored output for edn HOT 4
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 cq.