pazz / alot

Terminal-based Mail User Agent
GNU General Public License v3.0
681 stars 162 forks source link

commands/thread: Add option --strip_ansi to pipeto #1619

Open guludo opened 1 year ago

guludo commented 1 year ago

If someone has a mailcap entry that colors the mail content, it is possible that she would want to get the content without the CSI escapes when piping it an external command.

Ideally, there should be a way to have the content untouched by the mailcap filter so we could use it when it makes sense. However, let's use ansi.remove_csi() for the time being.

pazz commented 1 year ago

Shouldn't this default to true? when would you ever want these escape codes when piping stuff into other tools?

guludo commented 1 year ago

Shouldn't this default to true?

I agree that would be a better default. I just wanted to make sure I didn't break other people's workflow.

when would you ever want these escape codes when piping stuff into other tools?

I guess one use case is when using another program to view the email. One could, for example, pipe it to less -R.

Anyways, let me know if you prefer true to be the default, then I'll send a new version here.

pazz commented 11 months ago

Can you explain the use case for this? I mean, I have never seen these sequences in actual message contents and only ever added them for displaying stuff on the terminal.

guludo commented 11 months ago

For me, the use case was to apply a patch directly from the mail client.

pazz commented 11 months ago

But do the patch files you receive really have any ansi characters in them? That's what's confusing me here..

Quoting Gustavo José de Sousa (2023-07-26 14:38:50)

For me, the use case was to apply a patch directly from the mail client.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.*Message ID: <pazz/alot/pull/1619/ @.***>

guludo commented 11 months ago

But do the patch files you receive really have any ansi characters in them?

No, they do not. The issue is that I have a mailcap entry that colorizes the patch. When I use pipe_to, the content with the added escapes is what is piped.

pazz commented 11 months ago

Thanks for clarifying. I think there is something wrong with the pipeto command then: I believe it should only send the content of the mime part, not what has been piped through the mailcap entry. Will have to look into this at some point. Cheers!

Quoting Gustavo José de Sousa (2023-07-26 18:40:12)

But do the patch files you receive really have any ansi characters in them?

No, they do not. The issue is that I have a mailcap entry that colorizes the patch. When I use pipe_to, the content with the added escapes is what is piped.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.*Message ID: <pazz/alot/pull/1619/ @.***>