about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--man/mthread.17
-rw-r--r--mthread.c9
2 files changed, 11 insertions, 5 deletions
diff --git a/man/mthread.1 b/man/mthread.1
index cb2c29a..00bef88 100644
--- a/man/mthread.1
+++ b/man/mthread.1
@@ -6,8 +6,7 @@
 .Nd arrange messages into discussions
 .Sh SYNOPSIS
 .Nm
-.Op Fl v
-.Op Fl r
+.Op Fl vpr
 .Op Fl S Ar msg
 .Op Ar msgs\ ...
 .Sh DESCRIPTION
@@ -34,6 +33,10 @@ The options are as follows:
 .Bl -tag -width Ds
 .It Fl v
 Do not prune unresolved Message-IDs at the top-level.
+.It Fl p
+With
+.Fl S ,
+only add parents, not unrelated subthreads.
 .It Fl r
 Sort the top-level threads in reverse order (newest threads first).
 .It Fl S Ar msg
diff --git a/mthread.c b/mthread.c
index 300fcae..a29d7b2 100644
--- a/mthread.c
+++ b/mthread.c
@@ -21,6 +21,7 @@
 #include "blaze822.h"
 
 static int vflag;
+static int pflag;
 static int rflag;
 static int optional;
 
@@ -390,7 +391,8 @@ print_tree(struct container *c, int depth)
 {
 	do {
 		// skip toplevel threads when they are unresolved or all optional
-		if (depth <= 1 &&
+		// (or when -p is given, skip those subthreads)
+		if ((depth <= 1 || pflag) &&
 		    (c->optional || !c->file) &&
 		    (!c->child || alloptional(c->child)))
 			continue;
@@ -418,13 +420,14 @@ main(int argc, char *argv[])
 
 	optional = 1;
 
-	while ((c = getopt(argc, argv, "S:rv")) != -1)
+	while ((c = getopt(argc, argv, "S:prv")) != -1)
 		switch (c) {
 		case 'S': blaze822_loop1(optarg, thread); break;
 		case 'v': vflag = 1; break;
+		case 'p': pflag = 1; break;
 		case 'r': rflag = 1; break;
 		default:
-			fprintf(stderr, "Usage: mthread [-v] [-r] [-S dir] [msgs...]\n");
+			fprintf(stderr, "Usage: mthread [-vpr] [-S dir] [msgs...]\n");
 			exit(1);
 		}