todoist
todoist copied to clipboard
Color always
Add --color=always
option (or settings), in order to be able to pipe colors in pagers.
At the moment, if the output is redirected, colors are stripped.
What are you piping in to? less
? I would assume that less
is stripping the color, although with my minimal testing and very minimal knowledge of the inner workings of less
I'm not able to get less -R
or less -r
to work on MacOS
On Ubuntu (but I guess on any Linux distro) this works wonderfully:
exa --color=always | less -r
(just used exa
since ls
was the simplest thing came in my mind, but too simple to enforce colors).
P.S.: even less -R
works perfectly, of course
Using lsd--color=always
I was able to confirm that on MacOS using less -R
(or less -r
for that matter) keeps colors in tact. I'll look into what was used for formatting output to see if this is possible. I would think it is but I'm obviously not the author, just an enthusiast who likes fiddling with Go.
The issue is in the color library, I opened an issue on them: https://github.com/fatih/color/issues/179
When I dug into this, iirc, the color library supported it, it was a matter of adding another flag to todoist-cli and working that in. I had started but never finished. I'll take a look again tonight.
if someone wants to test the patch I just submitted, that would be helpful. It works for me when piping to less -R
. No changes needed to use.
I decided against expanding on the CLI options as there is a way to get a more flat-file-friendly output with the --csv
option. Thoughts are welcome.
I confirm it is working also for me. Thanks :)