ttytm / wthrr-the-weathercrab

🌞 🦀 🌙 Weather companion for the terminal. Rust app.
https://crates.io/crates/wthrr
MIT License
385 stars 26 forks source link

[FR]: Color: Always #267

Open jtrv opened 1 year ago

jtrv commented 1 year ago

It would be nice to have a setting/flag to always output ansi escape codes, so if you decide to write the output or pipe it etc, you can maintain colored output.

I currently have a "greeting" script that prints a few different things in my editor when I turn on my machine, including the output of this utility, however the output loses some readability when the ansi-colors are lost.

ttytm commented 1 year ago

Hey @jtrv,

Comprehensible use case. Gonna look into it when a moment opens up. Also, if you'd like to contribute, feel free :+1:

ttytm commented 6 days ago

@jtrv would it be possible to share the piece of your script and add some environment information? This would bring me closer to have something reproducible and concrete to address.

Best regards

jtrv commented 6 days ago

steps to reproduce:

wthrr > test.txt
cat test.txt

cat will render ansi escapes if present. You can also open test.txt in an editor to see that ansi escapes are not produced.

Environment:

Kernel:    6.11.1-zen1-1-zen
Distro:    Arch Linux
Shell:     fish
Terminal:  alacritty

I don't suspect this is an environmental issue.

ttytm commented 5 days ago

@jtrv

Would the script command work for you to capture the raw output?

This results in colored output / ansi contents in the file:

script --flush --quiet --return /tmp/wthrr-out.txt --command "wthrr"