sharkdp / numbat

A statically typed programming language for scientific computations with first class support for physical dimensions and units
https://numbat.dev
Apache License 2.0
1.01k stars 40 forks source link

Feature request: Option to disable color #428

Closed hellishvictor closed 1 month ago

hellishvictor commented 1 month ago

Hi, here I'm testing the cli, and since I'm on Win 7, it shows like this;

 Numbat is a statically typed programming language for scientific computations
 with first class support for physical dimensions and units. Please refer to
 the full documentation online at ←[32mhttps://numbat.dev/doc/←[0m or try one of these
 examples:

 >>> 8 km / (1 h + 25 min)
     ←[1m=←[0m ←[33m5.64706←[0m ←[36mkm/h←[0m←[2m    [←[0m←[3;34mVelocity←[0m←[2m]←[0m

 >>> atan2(30 cm, 1 m) -> deg
     ←[1m=←[0m ←[33m16.6992←[0m←[36m°←[0m

 >>> let ω = 2 π c / 660 nm

 >>> print("Energy of red photons: {ℏ ω -> eV}")

It gets very confusing with all the "←[1m=←[0m", so, an option to disable the color and display every in monochrome would be welcome. Cheers.

eminence commented 1 month ago

Please try running with the NO_COLOR=1 environment variable

hellishvictor commented 1 month ago

That did the trick, but please consider add the argument, (I use batch scripts with colorshow from Aacini) these cli already have it implemented:

https://github.com/MiSawa/xq --monochrome-output,-M Force monochrome output

https://github.com/wader/fq --monochrome-output,-M Force monochrome output

https://github.com/01mf02/jaq --color never

Cheers.

sharkdp commented 1 month ago

Thank you for the feedback. I'd be glad to accept a PR to add a --color=never/always/auto option, like most of my other CLI tools have as well.