[PATCH 1/2] Add 'cat' subcommand

Anthony Towns aj at erisian.com.au
Wed Apr 21 20:13:39 PDT 2010


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

?

> should we extend this to something generic that allows remote
> specifications?
> URI:file/path/to/local/file
> URI:ssh/user at host/path/to/file
> URI:git/user at host/path/to/file

You could already do that by using FUSE filesystems to mount your
remote mail dirs under those paths, without having to teach notmuch
about those protocols, as long as you still have the Xapian database
local.

If the Xapian database is remote, you need to invoke "ssh $USER@$HOST
notmuch" (or similar) instead of "notmuch", but the "cat" patch should
be enough to make that work right.

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

or

   [database]
   # multiple backends
   path=/home/aj/Mail
   path=git:///home/aj/OldMail.git

and have filename: just serve as a unique id that the database knows
how to convert to the contents of the file?

At most (afaics) maybe you'd want to say something like:

    [database]
    path=/home/aj/Mail
    path.old=git:///home/aj/OldMail.git

so that any filename starting with "old/" has the "old/" trimmed and
gets passed to the git backend, while the rest go to the default file
backend.

Cheers,
aj

-- 
Anthony Towns <aj at erisian.com.au>


More information about the notmuch mailing list