unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Jani Nikula <jani@nikula.org>
To: notmuch@notmuchmail.org
Subject: [PATCH 1/4] cli: make caller check tag count in parse_tag_command_line
Date: Tue, 22 Jan 2013 19:41:06 +0200	[thread overview]
Message-ID: <1a2c09adc1c963f1aa209c09143f85dca7634e11.1358876448.git.jani@nikula.org> (raw)

---
 notmuch-tag.c |    5 +++++
 tag-util.c    |    5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/notmuch-tag.c b/notmuch-tag.c
index d9daf8f..b2b22f7 100644
--- a/notmuch-tag.c
+++ b/notmuch-tag.c
@@ -234,6 +234,11 @@ notmuch_tag_command (void *ctx, int argc, char *argv[])
 	if (parse_tag_command_line (ctx, argc - opt_index, argv + opt_index,
 				    &query_string, tag_ops))
 	    return 1;
+
+	if (tag_op_list_size (tag_ops) == 0) {
+	    fprintf (stderr, "Error: 'notmuch tag' requires at least one tag to add or remove.\n");
+	    return 1;
+	}
     }
 
     config = notmuch_config_open (ctx, NULL, NULL);
diff --git a/tag-util.c b/tag-util.c
index 701d329..c5f5859 100644
--- a/tag-util.c
+++ b/tag-util.c
@@ -188,11 +188,6 @@ parse_tag_command_line (void *ctx, int argc, char **argv,
 	tag_op_list_append (tag_ops, argv[i] + 1, is_remove);
     }
 
-    if (tag_op_list_size (tag_ops) == 0) {
-	fprintf (stderr, "Error: 'notmuch tag' requires at least one tag to add or remove.\n");
-	return TAG_PARSE_INVALID;
-    }
-
     *query_str = query_string_from_args (ctx, argc - i, &argv[i]);
 
     if (*query_str == NULL || **query_str == '\0') {
-- 
1.7.10.4

             reply	other threads:[~2013-01-22 17:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-22 17:41 Jani Nikula [this message]
2013-01-22 17:41 ` [PATCH 2/4] cli: add --remove-all option to "notmuch tag" Jani Nikula
2013-02-25 19:34   ` Jani Nikula
2013-02-25 21:53     ` David Bremner
2013-01-22 17:41 ` [PATCH 3/4] man: document notmuch tag --remove-all Jani Nikula
2013-01-22 17:41 ` [PATCH 4/4] test: " 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=1a2c09adc1c963f1aa209c09143f85dca7634e11.1358876448.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).