Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Piping output of tasklite to file still includes colors #44

Open
jnduli opened this issue Nov 20, 2020 · 3 comments
Open

Piping output of tasklite to file still includes colors #44

jnduli opened this issue Nov 20, 2020 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@jnduli
Copy link

jnduli commented Nov 20, 2020

I'm not quite sure if this is a bug or something that needs to be fixed, but I recently piped output of tasklite to a file with tasklite >> file

The file still contains the color symbols though:

�[0;92;1;4mId �[0m  �[0;95;1;4mPrio�[0m  �[0;30;1;4mOpened UTC�[0m  �[0;97;1;4mBody      �[0m  
�[0;92mgq7�[0m  �[0;95m 0  �[0m  �[0;30m2020-11-20�[0m  �[0;97mtest 2�[0m
�[0;92m15h�[0m  �[0;95m 0  �[0m  �[0;30m2020-11-20�[0m  �[0;97mtest 1�[0m

I was able to fix this with a sed command I got, so if this is intended behaviour we can just close the issue (I'm also not sure how this can be fixed from the haskell side 😢 )

@ad-si
Copy link
Owner

ad-si commented Nov 20, 2020

Yeah, this is already on my own todo list.
The last time I checked there was no easy way to figure out wether you print to the terminal or pipe the output to another file. I know however, that it's possible in JavaScript. So implementing this with a flag would be an unsatisfying solution. 😅

I think I need to investigate a little further, but If anyone knows a way to achieve this, a tip would be highly appreciated 🙃.

@ad-si ad-si added the help wanted Extra attention is needed label Nov 20, 2020
@jnduli
Copy link
Author

jnduli commented Nov 20, 2020

Noted. I'll try to do some research on my side and comment if I find something plausible

@jnduli
Copy link
Author

jnduli commented Nov 21, 2020

Here's what I've found so far:

So a possible alternative would be to have a config that is set at run time depending on whether the output is tty or not.

Also adding a terminal option that will force colors if set. For example, if I do ls --color >> file the file has the colors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants