purebred-mua / purebred

A terminal based mail user agent based on notmuch
GNU Affero General Public License v3.0
139 stars 19 forks source link

The MailcapHandler currently can't deal with positional arguments #430

Open romanofski opened 3 years ago

romanofski commented 3 years ago

Is your feature request related to a problem? Please describe. The current MailcapHandler we use doesn't support positional arguments. For example pdftotext has the following synopsis: pdftotext [options] [PDF-file [text-file]]. I'd need something to represent our input file, which currently was just appended. However the last argument here needs to be the text-file which is typically stdout, so the typical template becomes: pdftotext %s -.

Describe the solution you'd like Haven't thought about it yet.

Describe alternatives you've considered None

Additional context I'd be keen to use pdftotext so I can view attached PDFs.

frasertweedale commented 3 years ago

Yeah. I'd like proper parsing of the mailcap format (https://datatracker.ietf.org/doc/html/rfc1524), and associated functions for preparing the subprocess given mailcap entry and body/part content.

Possibly belongs in a separate library but we can extract later if it seems useful.

romanofski commented 3 years ago

I've actually changed the type to a function (see https://github.com/purebred-mua/purebred/compare/feat/430/mailcaphandler-can-work-with-positional-arguments) which gets me what I want. However I agree, that better support for the mailcap file is the better approach, so we don't have to add this manually. Shall I put this into a separate feature request?

romanofski commented 3 years ago

I'm giving a mailcap parser a shot. Named the package purebred-mailcap for obvious reasons...

frasertweedale commented 3 years ago

@romanofski you should be able to reuse a bunch of the low-level parsers from purebred-email. Identify the useful subset and then we'll see if it makes sense to extract another package (purebred-parsing or whatever).

romanofski commented 3 years ago

@frasertweedale yeah I'm already using it as a reference. Thanks for the pointer!