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

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

Open
romanofski opened this issue May 14, 2021 · 5 comments
Open
Assignees
Labels
Milestone

Comments

@romanofski
Copy link
Member

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.

@romanofski romanofski added this to the 1.0 milestone May 14, 2021
romanofski added a commit that referenced this issue May 16, 2021
This changes the `MailcapHandler` to support commands with positional
arguments. The patch removes the additional types and uses the
re-exports from `System.Process.Typed` instead. I did not see any reason
why we would need the additional overhead.

Instead of types, the handler is now a function which accepts the mail
as input to allow crafting whatever command is necessary.

Fixes #430
@frasertweedale
Copy link
Member

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
Copy link
Member Author

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 romanofski self-assigned this Oct 4, 2021
@romanofski
Copy link
Member Author

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

@frasertweedale
Copy link
Member

@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
Copy link
Member Author

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

@frasertweedale frasertweedale modified the milestones: 1.0, 1.1 Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants