From 0d5b0e030a4c1843857906e99f9c0eb5e2185d5b Mon Sep 17 00:00:00 2001 From: david Date: Sun, 20 Jan 2013 14:25:53 +2000 Subject: [PATCH] [PATCH 2/7] CLI: remove alias machinery, and "part", "search-tags" commands --- 03/5c58eef7c9ef6014319d01a7045536ba6bad9c | 178 ++++++++++++++++++++++ 1 file changed, 178 insertions(+) create mode 100644 03/5c58eef7c9ef6014319d01a7045536ba6bad9c diff --git a/03/5c58eef7c9ef6014319d01a7045536ba6bad9c b/03/5c58eef7c9ef6014319d01a7045536ba6bad9c new file mode 100644 index 000000000..9c2967610 --- /dev/null +++ b/03/5c58eef7c9ef6014319d01a7045536ba6bad9c @@ -0,0 +1,178 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id AE94B431FBF + for ; Sat, 19 Jan 2013 10:26:12 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id M3gzGaXvVuuh for ; + Sat, 19 Jan 2013 10:26:11 -0800 (PST) +Received: from tesseract.cs.unb.ca (tesseract.cs.unb.ca [131.202.240.238]) + (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id B2902431FAF + for ; Sat, 19 Jan 2013 10:26:11 -0800 (PST) +Received: from fctnnbsc30w-156034082078.dhcp-dynamic.fibreop.nb.bellaliant.net + ([156.34.82.78] helo=zancas.localnet) + by tesseract.cs.unb.ca with esmtpsa + (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) + (envelope-from ) + id 1Twd7I-0007xI-Ia; Sat, 19 Jan 2013 14:26:09 -0400 +Received: from bremner by zancas.localnet with local (Exim 4.80) + (envelope-from ) + id 1Twd7D-0005ae-0a; Sat, 19 Jan 2013 14:26:03 -0400 +From: david@tethera.net +To: notmuch@notmuchmail.org +Subject: [PATCH 2/7] CLI: remove alias machinery, and "part", + "search-tags" commands +Date: Sat, 19 Jan 2013 14:25:53 -0400 +Message-Id: <1358619958-21209-3-git-send-email-david@tethera.net> +X-Mailer: git-send-email 1.7.10.4 +In-Reply-To: <1358619958-21209-1-git-send-email-david@tethera.net> +References: <1358619958-21209-1-git-send-email-david@tethera.net> +X-Spam_bar: - +Cc: David Bremner +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sat, 19 Jan 2013 18:26:15 -0000 + +From: David Bremner + +The commands are long deprecated, so removal is probably overdue. The +real motivation is to simplify argument handling for notmuch so that +we can migrate to the common argument parsing framework. +--- + NEWS | 8 ++++++++ + devel/TODO | 7 ------- + notmuch.c | 50 +------------------------------------------------- + 3 files changed, 9 insertions(+), 56 deletions(-) + +diff --git a/NEWS b/NEWS +index 1cb52dd..2ed472e 100644 +--- a/NEWS ++++ b/NEWS +@@ -1,3 +1,11 @@ ++Notmuch 0.16 (2013-MM-DD) ++========================= ++ ++Command-Line Interface ++---------------------- ++ ++Deprecated commands "part" and "search-tags" are removed. ++ + Notmuch 0.15 (2013-01-18) + ========================= + +diff --git a/devel/TODO b/devel/TODO +index eb757af..3741f0e 100644 +--- a/devel/TODO ++++ b/devel/TODO +@@ -118,13 +118,6 @@ file. + Allow configuration for filename patterns that should be ignored when + indexing. + +-Replace the "notmuch part --part=id" command with "notmuch show +---part=id", (David Edmondson wants to rewrite some of "notmuch show" to +-provide more MIME-structure information in its output first). +- +-Replace the "notmuch search-tags" command with "notmuch search +---output=tags". +- + Fix to avoid this ugly message: + + (process:17197): gmime-CRITICAL **: g_mime_message_get_mime_part: assertion `GMIME_IS_MESSAGE (message)' failed +diff --git a/notmuch.c b/notmuch.c +index 4fc0973..f13fd27 100644 +--- a/notmuch.c ++++ b/notmuch.c +@@ -31,18 +31,6 @@ typedef struct command { + const char *summary; + } command_t; + +-#define MAX_ALIAS_SUBSTITUTIONS 3 +- +-typedef struct alias { +- const char *name; +- const char *substitutions[MAX_ALIAS_SUBSTITUTIONS]; +-} alias_t; +- +-alias_t aliases[] = { +- { "part", { "show", "--format=raw"}}, +- { "search-tags", {"search", "--output=tags", "*"}} +-}; +- + static int + notmuch_help_command (void *ctx, int argc, char *argv[]); + +@@ -260,9 +248,7 @@ main (int argc, char *argv[]) + { + void *local; + command_t *command; +- alias_t *alias; +- unsigned int i, j; +- const char **argv_local; ++ unsigned int i; + + talloc_enable_null_tracking (); + +@@ -285,40 +271,6 @@ main (int argc, char *argv[]) + return 0; + } + +- for (i = 0; i < ARRAY_SIZE (aliases); i++) { +- alias = &aliases[i]; +- +- if (strcmp (argv[1], alias->name) == 0) +- { +- int substitutions; +- +- argv_local = talloc_size (local, sizeof (char *) * +- (argc + MAX_ALIAS_SUBSTITUTIONS - 1)); +- if (argv_local == NULL) { +- fprintf (stderr, "Out of memory.\n"); +- return 1; +- } +- +- /* Copy all substution arguments from the alias. */ +- argv_local[0] = argv[0]; +- for (j = 0; j < MAX_ALIAS_SUBSTITUTIONS; j++) { +- if (alias->substitutions[j] == NULL) +- break; +- argv_local[j+1] = alias->substitutions[j]; +- } +- substitutions = j; +- +- /* And copy all original arguments (skipping the argument +- * that matched the alias of course. */ +- for (j = 2; j < (unsigned) argc; j++) { +- argv_local[substitutions+j-1] = argv[j]; +- } +- +- argc += substitutions - 1; +- argv = (char **) argv_local; +- } +- } +- + for (i = 0; i < ARRAY_SIZE (commands); i++) { + command = &commands[i]; + +-- +1.7.10.4 + -- 2.26.2