1 Return-Path: <tomi.ollila@iki.fi>
\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 92A2B431FC0
\r
6 for <notmuch@notmuchmail.org>; Sat, 22 Mar 2014 06:18:10 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]
\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 9Fw5QPEFoyx0 for <notmuch@notmuchmail.org>;
\r
16 Sat, 22 Mar 2014 06:18:03 -0700 (PDT)
\r
17 Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34])
\r
18 by olra.theworths.org (Postfix) with ESMTP id 93ACA431FBC
\r
19 for <notmuch@notmuchmail.org>; Sat, 22 Mar 2014 06:18:03 -0700 (PDT)
\r
20 Received: from guru.guru-group.fi (localhost [IPv6:::1])
\r
21 by guru.guru-group.fi (Postfix) with ESMTP id 9AC1E100033;
\r
22 Sat, 22 Mar 2014 15:17:53 +0200 (EET)
\r
23 From: Tomi Ollila <tomi.ollila@iki.fi>
\r
24 To: Jani Nikula <jani@nikula.org>, notmuch@notmuchmail.org
\r
25 Subject: Re: [PATCH] cli: fix notmuch help additional topics
\r
26 In-Reply-To: <1395493618-29168-1-git-send-email-jani@nikula.org>
\r
27 References: <1395493618-29168-1-git-send-email-jani@nikula.org>
\r
28 User-Agent: Notmuch/0.17+155~g3416ef5 (http://notmuchmail.org) Emacs/24.3.1
\r
29 (x86_64-unknown-linux-gnu)
\r
30 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL
\r
31 $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F
\r
32 !)g;OY^,BjTbr)Np:%c_o'jj,Z
\r
33 Date: Sat, 22 Mar 2014 15:17:53 +0200
\r
34 Message-ID: <m2r45utlry.fsf@guru.guru-group.fi>
\r
36 Content-Type: text/plain
\r
37 X-BeenThere: notmuch@notmuchmail.org
\r
38 X-Mailman-Version: 2.1.13
\r
40 List-Id: "Use and development of the notmuch mail system."
\r
41 <notmuch.notmuchmail.org>
\r
42 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
43 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
44 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
45 List-Post: <mailto:notmuch@notmuchmail.org>
\r
46 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
47 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
48 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
49 X-List-Received-Date: Sat, 22 Mar 2014 13:18:10 -0000
\r
51 On Sat, Mar 22 2014, Jani Nikula <jani@nikula.org> wrote:
\r
53 > The help for hooks was missing.
\r
57 The code changes LGTM.
\r
61 > notmuch.c | 40 +++++++++++++++++++++++++++++++++-------
\r
62 > 1 file changed, 33 insertions(+), 7 deletions(-)
\r
64 > diff --git a/notmuch.c b/notmuch.c
\r
65 > index b3fa9f378545..dcda0392a094 100644
\r
68 > @@ -74,6 +74,18 @@ static command_t commands[] = {
\r
69 > "This message, or more detailed help for the named command." }
\r
72 > +typedef struct help_topic {
\r
73 > + const char *name;
\r
74 > + const char *summary;
\r
77 > +static help_topic_t help_topics[] = {
\r
78 > + { "search-terms",
\r
79 > + "Common search term syntax." },
\r
81 > + "Hooks that will be run before or after certain commands." },
\r
84 > static command_t *
\r
85 > find_command (const char *name)
\r
87 > @@ -93,6 +105,7 @@ static void
\r
90 > command_t *command;
\r
91 > + help_topic_t *topic;
\r
95 > @@ -107,13 +120,22 @@ usage (FILE *out)
\r
96 > command = &commands[i];
\r
98 > if (command->name)
\r
99 > - fprintf (out, " %-11s %s\n", command->name, command->summary);
\r
100 > + fprintf (out, " %-12s %s\n", command->name, command->summary);
\r
103 > + fprintf (out, "\n");
\r
104 > + fprintf (out, "Additional help topics are as follows:\n");
\r
105 > + fprintf (out, "\n");
\r
107 > + for (i = 0; i < ARRAY_SIZE (help_topics); i++) {
\r
108 > + topic = &help_topics[i];
\r
109 > + fprintf (out, " %-12s %s\n", topic->name, topic->summary);
\r
112 > fprintf (out, "\n");
\r
114 > - "Use \"notmuch help <command>\" for more details on each command\n"
\r
115 > - "and \"notmuch help search-terms\" for the common search-terms syntax.\n\n");
\r
116 > + "Use \"notmuch help <command or topic>\" for more details "
\r
117 > + "on each command or topic.\n\n");
\r
121 > @@ -156,6 +178,8 @@ static int
\r
122 > notmuch_help_command (notmuch_config_t *config, int argc, char *argv[])
\r
124 > command_t *command;
\r
125 > + help_topic_t *topic;
\r
126 > + unsigned int i;
\r
128 > argc--; argv++; /* Ignore "help" */
\r
130 > @@ -180,10 +204,12 @@ notmuch_help_command (notmuch_config_t *config, int argc, char *argv[])
\r
134 > - if (strcmp (argv[0], "search-terms") == 0) {
\r
135 > - exec_man ("notmuch-search-terms");
\r
136 > - } else if (strcmp (argv[0], "hooks") == 0) {
\r
137 > - exec_man ("notmuch-hooks");
\r
138 > + for (i = 0; i < ARRAY_SIZE (help_topics); i++) {
\r
139 > + topic = &help_topics[i];
\r
140 > + if (strcmp (argv[0], topic->name) == 0) {
\r
141 > + char *page = talloc_asprintf (config, "notmuch-%s", topic->name);
\r
142 > + exec_man (page);
\r
150 > _______________________________________________
\r
151 > notmuch mailing list
\r
152 > notmuch@notmuchmail.org
\r
153 > http://notmuchmail.org/mailman/listinfo/notmuch
\r