Re: [PATCH] Fix typo in Message.maildir_flags_to_tags
[notmuch-archives.git] / 37 / 88010548b1d38a7e54ea596b51608a755001f3
1 Return-Path: <jani@nikula.org>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id ED93D431FC0\r
6         for <notmuch@notmuchmail.org>; Sat, 22 Mar 2014 06:07:09 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id SmUKr+gsOGpF for <notmuch@notmuchmail.org>;\r
16         Sat, 22 Mar 2014 06:07:04 -0700 (PDT)\r
17 Received: from mail-la0-f48.google.com (mail-la0-f48.google.com\r
18         [209.85.215.48]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 3203B431FBC\r
21         for <notmuch@notmuchmail.org>; Sat, 22 Mar 2014 06:07:04 -0700 (PDT)\r
22 Received: by mail-la0-f48.google.com with SMTP id gf5so2447959lab.35\r
23         for <notmuch@notmuchmail.org>; Sat, 22 Mar 2014 06:07:02 -0700 (PDT)\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
25         d=1e100.net; s=20130820;\r
26         h=x-gm-message-state:from:to:cc:subject:date:message-id;\r
27         bh=NDk1WekWTEbvd4u0kvdCwekVPVeDvt3wQJVAiRVHUAc=;\r
28         b=b+qJx2t+r45Ht1zPlFPw70bXDv4cGr1zyEzYlYieWvTlMrooetfAMAjit7hM5UV3dx\r
29         zJL+fInTAPwa6BJlEOzYNAXO/Parlwwq+ZsS8p/j6Tec5keBlp+rSakB3H1Rurbe7804\r
30         U+Drf166d8Ty/bjxTnOPjzCYd3iB6eBPu5q8q10+hqGtjZsS7V+jDtylUoN63t8vJQtK\r
31         fb5Q0BSE7BAzoCpn7PjDGg+lSjqLVFScP5jFkL0ODvL8EFuv/bY0XdjbiPdCJ/c5Naqx\r
32         4++PS7RFu1bGev2ePciANJZ4ubpSuUtv95wI4ujugA2T/nBm9wQl5ZDV3cckGh1dwx7M\r
33         TrNQ==\r
34 X-Gm-Message-State:\r
35  ALoCoQluvm0YVlcms9cqZcy+Wk8Fft8FksocQr/DVcowvb05KzGaL6VZhtj97Og3gEtwglhxBINt\r
36 X-Received: by 10.112.47.3 with SMTP id z3mr1543737lbm.34.1395493621302;\r
37         Sat, 22 Mar 2014 06:07:01 -0700 (PDT)\r
38 Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
39         [88.195.111.91])\r
40         by mx.google.com with ESMTPSA id z10sm5383516lbu.1.2014.03.22.06.06.59\r
41         for <multiple recipients>\r
42         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
43         Sat, 22 Mar 2014 06:07:00 -0700 (PDT)\r
44 From: Jani Nikula <jani@nikula.org>\r
45 To: notmuch@notmuchmail.org\r
46 Subject: [PATCH] cli: fix notmuch help additional topics\r
47 Date: Sat, 22 Mar 2014 15:06:58 +0200\r
48 Message-Id: <1395493618-29168-1-git-send-email-jani@nikula.org>\r
49 X-Mailer: git-send-email 1.9.0\r
50 X-BeenThere: notmuch@notmuchmail.org\r
51 X-Mailman-Version: 2.1.13\r
52 Precedence: list\r
53 List-Id: "Use and development of the notmuch mail system."\r
54         <notmuch.notmuchmail.org>\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
58 List-Post: <mailto:notmuch@notmuchmail.org>\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
62 X-List-Received-Date: Sat, 22 Mar 2014 13:07:10 -0000\r
63 \r
64 The help for hooks was missing.\r
65 ---\r
66  notmuch.c | 40 +++++++++++++++++++++++++++++++++-------\r
67  1 file changed, 33 insertions(+), 7 deletions(-)\r
68 \r
69 diff --git a/notmuch.c b/notmuch.c\r
70 index b3fa9f378545..dcda0392a094 100644\r
71 --- a/notmuch.c\r
72 +++ b/notmuch.c\r
73 @@ -74,6 +74,18 @@ static command_t commands[] = {\r
74        "This message, or more detailed help for the named command." }\r
75  };\r
76  \r
77 +typedef struct help_topic {\r
78 +    const char *name;\r
79 +    const char *summary;\r
80 +} help_topic_t;\r
81 +\r
82 +static help_topic_t help_topics[] = {\r
83 +    { "search-terms",\r
84 +      "Common search term syntax." },\r
85 +    { "hooks",\r
86 +      "Hooks that will be run before or after certain commands." },\r
87 +};\r
88 +\r
89  static command_t *\r
90  find_command (const char *name)\r
91  {\r
92 @@ -93,6 +105,7 @@ static void\r
93  usage (FILE *out)\r
94  {\r
95      command_t *command;\r
96 +    help_topic_t *topic;\r
97      unsigned int i;\r
98  \r
99      fprintf (out,\r
100 @@ -107,13 +120,22 @@ usage (FILE *out)\r
101         command = &commands[i];\r
102  \r
103         if (command->name)\r
104 -           fprintf (out, "  %-11s  %s\n", command->name, command->summary);\r
105 +           fprintf (out, "  %-12s  %s\n", command->name, command->summary);\r
106 +    }\r
107 +\r
108 +    fprintf (out, "\n");\r
109 +    fprintf (out, "Additional help topics are as follows:\n");\r
110 +    fprintf (out, "\n");\r
111 +\r
112 +    for (i = 0; i < ARRAY_SIZE (help_topics); i++) {\r
113 +       topic = &help_topics[i];\r
114 +       fprintf (out, "  %-12s  %s\n", topic->name, topic->summary);\r
115      }\r
116  \r
117      fprintf (out, "\n");\r
118      fprintf (out,\r
119 -    "Use \"notmuch help <command>\" for more details on each command\n"\r
120 -    "and \"notmuch help search-terms\" for the common search-terms syntax.\n\n");\r
121 +            "Use \"notmuch help <command or topic>\" for more details "\r
122 +            "on each command or topic.\n\n");\r
123  }\r
124  \r
125  void\r
126 @@ -156,6 +178,8 @@ static int\r
127  notmuch_help_command (notmuch_config_t *config, int argc, char *argv[])\r
128  {\r
129      command_t *command;\r
130 +    help_topic_t *topic;\r
131 +    unsigned int i;\r
132  \r
133      argc--; argv++; /* Ignore "help" */\r
134  \r
135 @@ -180,10 +204,12 @@ notmuch_help_command (notmuch_config_t *config, int argc, char *argv[])\r
136         exec_man (page);\r
137      }\r
138  \r
139 -    if (strcmp (argv[0], "search-terms") == 0) {\r
140 -       exec_man ("notmuch-search-terms");\r
141 -    } else if (strcmp (argv[0], "hooks") == 0) {\r
142 -       exec_man ("notmuch-hooks");\r
143 +    for (i = 0; i < ARRAY_SIZE (help_topics); i++) {\r
144 +       topic = &help_topics[i];\r
145 +       if (strcmp (argv[0], topic->name) == 0) {\r
146 +           char *page = talloc_asprintf (config, "notmuch-%s", topic->name);\r
147 +           exec_man (page);\r
148 +       }\r
149      }\r
150  \r
151      fprintf (stderr,\r
152 -- \r
153 1.9.0\r
154 \r