[PATCH 2/7] CLI: remove alias machinery, and "part", "search-tags" commands
authordavid <david@tethera.net>
Sat, 19 Jan 2013 18:25:53 +0000 (14:25 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:53:11 +0000 (09:53 -0800)
03/5c58eef7c9ef6014319d01a7045536ba6bad9c [new file with mode: 0644]

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