[PATCH] configure: add --without-api-docs option
[notmuch-archives.git] / 60 / d7471f8e64dc20a4f9448faf8aad086e3d019b
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 92D5642114C\r
6         for <notmuch@notmuchmail.org>; Sat, 31 Aug 2013 23:12:02 -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 as0yIQl0xuyV for <notmuch@notmuchmail.org>;\r
16         Sat, 31 Aug 2013 23:11:55 -0700 (PDT)\r
17 Received: from mail-ee0-f49.google.com (mail-ee0-f49.google.com\r
18  [74.125.83.49])        (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
19  certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
20  9138B4092A1    for <notmuch@notmuchmail.org>; Sat, 31 Aug 2013 03:34:34 -0700\r
21  (PDT)\r
22 Received: by mail-ee0-f49.google.com with SMTP id d41so1357926eek.22\r
23         for <notmuch@notmuchmail.org>; Sat, 31 Aug 2013 03:34:33 -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=9GgMlPzsIeZ0/remkd5X4LIyibKDBPYYIr/ucCmWp9k=;\r
28         b=GH0V1OH0JcJUg7Y7OnYk91sZufBIHXu77wxe/7bZv/MmvlaGA2KEJbaquG36V+ffTd\r
29         PtpezAVUNv+B0CdxiFASKi61OyoFiWmBGUvpNjGKM8Epu1SlLziSbBMTfnifvubeo3os\r
30         B0qvu0NtQKHfS2082mCHLGf3cO5j0vT/jDW5I9MQvvUQ+GuTg0tmRZHhis2j3t+S3JdE\r
31         IM6Hy63P6IW9YVobvXKv+Btt/QJ8zhFi+qLFWrz7QFPKUIZlUAdOGvOOx7MH3hOPd8CC\r
32         4dJnCLoDmXxaDfzWm+gppvN8j6sAbUq/iVoyiRnf+GYG7cwot7SjlO/XBG4BDR+sbZwa\r
33         lLtw==\r
34 X-Gm-Message-State:\r
35  ALoCoQl/J+RIln6oP4/RTHYXAj0KTvap2hAYeZvq4qksP/yenVfXVH13zFDcUx08csFsq88pS/pb\r
36 X-Received: by 10.15.26.7 with SMTP id m7mr2355856eeu.56.1377945272020;\r
37         Sat, 31 Aug 2013 03:34:32 -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 r48sm4021354eev.14.1969.12.31.16.00.00\r
41         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
42         Sat, 31 Aug 2013 03:34:31 -0700 (PDT)\r
43 From: Jani Nikula <jani@nikula.org>\r
44 To: notmuch@notmuchmail.org\r
45 Subject: [RFC PATCH 1/2] cli: add support for global options that get passed\r
46         to sub-commands\r
47 Date: Sat, 31 Aug 2013 13:34:30 +0300\r
48 Message-Id:\r
49  <08036456064699510ef832f0c6740d98d324d185.1377945239.git.jani@nikula.org>\r
50 X-Mailer: git-send-email 1.7.10.4\r
51 X-BeenThere: notmuch@notmuchmail.org\r
52 X-Mailman-Version: 2.1.13\r
53 Precedence: list\r
54 List-Id: "Use and development of the notmuch mail system."\r
55         <notmuch.notmuchmail.org>\r
56 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
58 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
59 List-Post: <mailto:notmuch@notmuchmail.org>\r
60 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
61 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
63 X-List-Received-Date: Sun, 01 Sep 2013 06:12:02 -0000\r
64 \r
65 This allows sub-commands to have access to global options.\r
66 ---\r
67  notmuch-client.h |   21 +++++++++++++++++++++\r
68  notmuch-config.c |   29 +++++++++++++++++++++++++++++\r
69  notmuch.c        |   10 ++++++++++\r
70  3 files changed, 60 insertions(+)\r
71 \r
72 diff --git a/notmuch-client.h b/notmuch-client.h\r
73 index afb0ddf..5656426 100644\r
74 --- a/notmuch-client.h\r
75 +++ b/notmuch-client.h\r
76 @@ -320,6 +320,27 @@ notmuch_config_set_search_exclude_tags (notmuch_config_t *config,\r
77                                       const char *list[],\r
78                                       size_t length);\r
79  \r
80 +/* global options */\r
81 +typedef struct _notmuch_global_options {\r
82 +    notmuch_bool_t debug;\r
83 +    notmuch_bool_t verbose;\r
84 +    notmuch_bool_t no_hooks;\r
85 +} notmuch_global_options_t;\r
86 +\r
87 +void\r
88 +notmuch_global_set (notmuch_config_t *config,\r
89 +                   const notmuch_global_options_t *global_options);\r
90 +\r
91 +notmuch_bool_t\r
92 +notmuch_global_get_debug (notmuch_config_t *config);\r
93 +\r
94 +notmuch_bool_t\r
95 +notmuch_global_get_verbose (notmuch_config_t *config);\r
96 +\r
97 +notmuch_bool_t\r
98 +notmuch_global_get_no_hooks (notmuch_config_t *config);\r
99 +\r
100 +\r
101  int\r
102  notmuch_run_hook (const char *db_path, const char *hook);\r
103  \r
104 diff --git a/notmuch-config.c b/notmuch-config.c\r
105 index 6845e3c..4cb29eb 100644\r
106 --- a/notmuch-config.c\r
107 +++ b/notmuch-config.c\r
108 @@ -118,6 +118,9 @@ struct _notmuch_config {\r
109      notmuch_bool_t maildir_synchronize_flags;\r
110      const char **search_exclude_tags;\r
111      size_t search_exclude_tags_length;\r
112 +\r
113 +    /* global options */\r
114 +    notmuch_global_options_t global_options;\r
115  };\r
116  \r
117  static int\r
118 @@ -883,3 +886,29 @@ notmuch_config_set_maildir_synchronize_flags (notmuch_config_t *config,\r
119                             "maildir", "synchronize_flags", synchronize_flags);\r
120      config->maildir_synchronize_flags = synchronize_flags;\r
121  }\r
122 +\r
123 +/* global options */\r
124 +void\r
125 +notmuch_global_set (notmuch_config_t *config,\r
126 +                   const notmuch_global_options_t *global_options)\r
127 +{\r
128 +    config->global_options = *global_options;\r
129 +}\r
130 +\r
131 +notmuch_bool_t\r
132 +notmuch_global_get_debug (notmuch_config_t *config)\r
133 +{\r
134 +    return config->global_options.debug;\r
135 +}\r
136 +\r
137 +notmuch_bool_t\r
138 +notmuch_global_get_verbose (notmuch_config_t *config)\r
139 +{\r
140 +    return config->global_options.verbose;\r
141 +}\r
142 +\r
143 +notmuch_bool_t\r
144 +notmuch_global_get_no_hooks (notmuch_config_t *config)\r
145 +{\r
146 +    return config->global_options.no_hooks;\r
147 +}\r
148 diff --git a/notmuch.c b/notmuch.c\r
149 index 78d29a8..11cdfd7 100644\r
150 --- a/notmuch.c\r
151 +++ b/notmuch.c\r
152 @@ -252,11 +252,19 @@ main (int argc, char *argv[])\r
153      notmuch_bool_t print_help=FALSE, print_version=FALSE;\r
154      int opt_index;\r
155      int ret = 0;\r
156 +    notmuch_global_options_t global_options = {\r
157 +       .debug = FALSE,\r
158 +       .verbose = FALSE,\r
159 +       .no_hooks = FALSE,\r
160 +    };\r
161  \r
162      notmuch_opt_desc_t options[] = {\r
163         { NOTMUCH_OPT_BOOLEAN, &print_help, "help", 'h', 0 },\r
164         { NOTMUCH_OPT_BOOLEAN, &print_version, "version", 'v', 0 },\r
165         { NOTMUCH_OPT_STRING, &config_file_name, "config", 'c', 0 },\r
166 +       { NOTMUCH_OPT_BOOLEAN, &global_options.debug, "debug", 'd', 0 },\r
167 +       { NOTMUCH_OPT_BOOLEAN, &global_options.verbose, "verbose", 'V', 0 },\r
168 +       { NOTMUCH_OPT_BOOLEAN, &global_options.no_hooks, "no-hooks", 'N', 0 },\r
169         { 0, 0, 0, 0, 0 }\r
170      };\r
171  \r
172 @@ -300,6 +308,8 @@ main (int argc, char *argv[])\r
173      if (!config)\r
174         return 1;\r
175  \r
176 +    notmuch_global_set (config, &global_options);\r
177 +\r
178      ret = (command->function)(config, argc - opt_index, argv + opt_index);\r
179  \r
180      notmuch_config_close (config);\r
181 -- \r
182 1.7.10.4\r
183 \r