[PATCH 1/2] Add 'cat' subcommand

Michal Sojka sojkam1 at fel.cvut.cz
Wed Apr 21 23:57:55 PDT 2010


On Thu, 22 Apr 2010, Anthony Towns wrote:
> On Thu, Apr 22, 2010 at 12:37, Dirk Hohndel <hohndel at infradead.org> wrote:
> > On Wed, 21 Apr 2010 17:44:03 -0700, Carl Worth <cworth at cworth.org> wrote:
> >> So I'd prefer to have this command behave just like all others and use
> >> the same naming.
> >>       filename:/complete/path/to/file
> 
> Would "notmuch cat" be any different to "notmuch show" in this case?
> What happens if you say "notmuch cat something" and multiple messages
> match (eg, an id: for a mail that you both sent (Mail/.sent/cur/12345)
> and received (Mail/.Lists.notmuch/cur/12346))?
> 
> Maybe notmuch show should be able to deal with all these things, and
> notmuch cat could be an alias for something like:
> 
>     notmuch show --format=mbox --show-duplicate-files $SPEC

I think this was discussed earlier with part subcommand and the result
was that "part" should become a part of show. The same probably applies
to the cat subcommand.

I don't think that --format=mbox is the right thing to do. A simple

    grep -R '^From[^:]' ~/mail

shows that I have many messages where "From" is present in the body at
the beginning of the line so it would have to be escaped and all the
tools dealing with this output need to de-escape it.

I think that --format=raw is better and this command should fail if the
query produces more than one message.

> Otherwise, wouldn't you be better off just having this be something
> for the database::path setting in .notmuch-config? So you say:
> 
>    [database]
>    path=/home/aj/Mail
> 
> or
> 
>    [database]
>    path=/home/aj/Mail/.git
>    format=git

This is something similar to what I have implemented in
id:1270737766-29237-1-git-send-email-sojkam1 at fel.cvut.cz. Carl doesn't
want to merge it in its current form so I'm extracting some features
from it and sending them separately.

-Michal


More information about the notmuch mailing list