Inconsistent output from "notmuch search --output=<foo>"

Subject: Inconsistent output from "notmuch search --output=<foo>"

Date: Tue, 23 Nov 2010 18:09:03 -0800

To: notmuch@notmuchmail.org

Cc:

From: Carl Worth


I just committed a bug fix for the missing final newline from "notmuch
search --output=tags". I don't recall who reported the bug, but thanks!

Michal, in trying to add a test for that bug, I found that the current
test suite infrastructure can't catch it because the shell's $()
construct doesn't distinguish whether that final newline is present or
not. I don't see an easy way to fix this, (other than making all tests
put results into files and making test_expect_equal accept those
filenames). Do you see any easy fix?

Meanwhile, while adding the --output= test, I noticed some inconsistency
in the output:

	$ notmuch search --output=threads ... | head -1
        thread:0000000000000c3c

        $ notmuch search --output=messages ... | head -1
        id:1272355278.3878.111.camel@thor.local

        $ notmuch search --output=files ... | head -1
	/path/to/maildir/1272355352.M909256P19063V18F0_0,S=9415

	$ notmuch search --output=tags ... | head -1
	attachment

The inconsistency is the presence of the "thread:" and "id:" prefixes in
the first two cases, (note that there isn't any "tag:" prefix in the
last case). I can't find any good justification for these.

I think the right answer is to drop those prefixes in the output. Does
anybody disagree? Does anyone have any scripts that are already
consuming the output of "notmuch search --output=threads" or "notmuch
search --output=messages" yet?

Note that the --format=json output won't be affected by the change I'm
proposing here.

-Carl

--
carl.d.worth@intel.com

Thread: