Git Product home page Git Product logo

Comments (8)

markus-wa avatar markus-wa commented on June 8, 2024 1

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.

Macroz avatar Macroz commented on June 8, 2024

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.

markus-wa avatar markus-wa commented on June 8, 2024

implemented in the latest release - thanks @Macroz https://github.com/markus-wa/cq/releases/tag/2022.10.12-14.51.05

from cq.

hukka avatar hukka commented on June 8, 2024

pretty was released with automatic logic for enabling colors. Seems pretty straightforward: clj-commons/pretty@7cb0c16

from cq.

markus-wa avatar markus-wa commented on June 8, 2024

Thanks @hukka - I've created #18 to support this.

PRs welcome as I probably won't get to this for a while

from cq.

Macroz avatar Macroz commented on June 8, 2024

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.

markus-wa avatar markus-wa commented on June 8, 2024

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.

Macroz avatar Macroz commented on June 8, 2024

Right!

How about this for a PR #20?

from cq.

Related Issues (8)

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.