From: Jani Nikula <jani@nikula.org>
To: notmuch@notmuchmail.org
Subject: [PATCH 7/9] cli: use the negating boolean support for new and insert --no-hooks
Date: Tue, 19 Sep 2017 23:39:27 +0300 [thread overview]
Message-ID: <ed0756cc553d55488eb7e562ae33cc21f0d83336.1505853159.git.jani@nikula.org> (raw)
In-Reply-To: <cover.1505853159.git.jani@nikula.org>
In-Reply-To: <cover.1505853159.git.jani@nikula.org>
This lets us use the positive hooks variable in code, increasing
clarity.
---
notmuch-insert.c | 6 +++---
notmuch-new.c | 8 ++++----
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/notmuch-insert.c b/notmuch-insert.c
index 648bd944a7b1..f0a3a33812a8 100644
--- a/notmuch-insert.c
+++ b/notmuch-insert.c
@@ -455,7 +455,7 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
char *folder = NULL;
notmuch_bool_t create_folder = FALSE;
notmuch_bool_t keep = FALSE;
- notmuch_bool_t no_hooks = FALSE;
+ notmuch_bool_t hooks = TRUE;
notmuch_bool_t synchronize_flags;
const char *maildir;
char *newpath;
@@ -466,7 +466,7 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
{ NOTMUCH_OPT_STRING, &folder, "folder", 0, 0 },
{ NOTMUCH_OPT_BOOLEAN, &create_folder, "create-folder", 0, 0 },
{ NOTMUCH_OPT_BOOLEAN, &keep, "keep", 0, 0 },
- { NOTMUCH_OPT_BOOLEAN, &no_hooks, "no-hooks", 'n', 0 },
+ { NOTMUCH_OPT_BOOLEAN, &hooks, "hooks", 'n', 0 },
{ NOTMUCH_OPT_INHERIT, (void *) ¬much_shared_options, NULL, 0, 0 },
{ NOTMUCH_OPT_END, 0, 0, 0, 0 }
};
@@ -575,7 +575,7 @@ notmuch_insert_command (notmuch_config_t *config, int argc, char *argv[])
}
}
- if (! no_hooks && status == NOTMUCH_STATUS_SUCCESS) {
+ if (hooks && status == NOTMUCH_STATUS_SUCCESS) {
/* Ignore hook failures. */
notmuch_run_hook (db_path, "post-insert");
}
diff --git a/notmuch-new.c b/notmuch-new.c
index faeb8f0a5896..cffecf745f1d 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -948,7 +948,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
int opt_index;
unsigned int i;
notmuch_bool_t timer_is_active = FALSE;
- notmuch_bool_t no_hooks = FALSE;
+ notmuch_bool_t hooks = TRUE;
notmuch_bool_t quiet = FALSE, verbose = FALSE;
notmuch_status_t status;
@@ -956,7 +956,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
{ NOTMUCH_OPT_BOOLEAN, &quiet, "quiet", 'q', 0 },
{ NOTMUCH_OPT_BOOLEAN, &verbose, "verbose", 'v', 0 },
{ NOTMUCH_OPT_BOOLEAN, &add_files_state.debug, "debug", 'd', 0 },
- { NOTMUCH_OPT_BOOLEAN, &no_hooks, "no-hooks", 'n', 0 },
+ { NOTMUCH_OPT_BOOLEAN, &hooks, "hooks", 'n', 0 },
{ NOTMUCH_OPT_INHERIT, (void *) ¬much_shared_options, NULL, 0, 0 },
{ 0, 0, 0, 0, 0 }
};
@@ -989,7 +989,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
}
}
- if (!no_hooks) {
+ if (hooks) {
ret = notmuch_run_hook (db_path, "pre-new");
if (ret)
return EXIT_FAILURE;
@@ -1154,7 +1154,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[])
notmuch_database_destroy (notmuch);
- if (!no_hooks && !ret && !interrupted)
+ if (hooks && !ret && !interrupted)
ret = notmuch_run_hook (db_path, "post-new");
if (ret || interrupted)
--
2.11.0
next prev parent reply other threads:[~2017-09-19 20:39 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-19 20:39 [PATCH 0/9] argument parsing fixes and improvements Jani Nikula
2017-09-19 20:39 ` [PATCH 1/9] hex-xcode: use notmuch_bool_t for boolean arguments Jani Nikula
2017-09-19 20:39 ` [PATCH 2/9] cli: use notmuch_bool_t for boolean argument in show Jani Nikula
2017-09-19 20:39 ` [PATCH 3/9] cli: refactor boolean argument processing Jani Nikula
2017-09-19 20:39 ` [PATCH 4/9] cli: change while to for in keyword " Jani Nikula
2017-09-19 20:39 ` [PATCH 5/9] cli: reduce indent " Jani Nikula
2017-09-19 20:39 ` [PATCH 6/9] cli: add support for --no- prefixed boolean and keyword flag arguments Jani Nikula
2017-09-19 20:39 ` Jani Nikula [this message]
2017-09-19 20:39 ` [PATCH 8/9] test: add boolean argument to arg-test Jani Nikula
2017-09-19 20:39 ` [PATCH 9/9] test: expand argument parsing sanity checks Jani Nikula
2017-09-19 21:43 ` [PATCH 0/9] argument parsing fixes and improvements Daniel Kahn Gillmor
2017-09-20 9:16 ` Jani Nikula
2017-09-20 13:21 ` Daniel Kahn Gillmor
2017-09-21 17:07 ` Jani Nikula
2017-09-21 18:52 ` Daniel Kahn Gillmor
2017-09-25 11:34 ` David Bremner
2017-09-25 13:02 ` Daniel Kahn Gillmor
2017-09-25 20:57 ` David Bremner
2017-09-30 9:40 ` Jani Nikula
2017-09-30 21:37 ` Jani Nikula
2017-10-01 11:11 ` David Bremner
2017-10-01 20:57 ` Jani Nikula
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ed0756cc553d55488eb7e562ae33cc21f0d83336.1505853159.git.jani@nikula.org \
--to=jani@nikula.org \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).