mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-25 02:44:53 +01:00
Make reply/show/tag all require at least one search term
In particular, notmuch tag -inbox "" tended to take a long time to run, happened if you hit 'a' on a blank line in the search view and probably didn't have the desired effect. Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
956917915f
commit
394cb1c46d
3 changed files with 22 additions and 12 deletions
|
@ -196,16 +196,21 @@ notmuch_reply_command (void *ctx, int argc, char *argv[])
|
|||
if (config == NULL)
|
||||
return 1;
|
||||
|
||||
notmuch = notmuch_database_open (notmuch_config_get_database_path (config));
|
||||
if (notmuch == NULL)
|
||||
return 1;
|
||||
|
||||
query_string = query_string_from_args (ctx, argc, argv);
|
||||
if (query_string == NULL) {
|
||||
fprintf (stderr, "Out of memory\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (*query_string == '\0') {
|
||||
fprintf (stderr, "Error: notmuch reply requires at least one search term.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
notmuch = notmuch_database_open (notmuch_config_get_database_path (config));
|
||||
if (notmuch == NULL)
|
||||
return 1;
|
||||
|
||||
query = notmuch_query_create (notmuch, query_string);
|
||||
if (query == NULL) {
|
||||
fprintf (stderr, "Out of memory\n");
|
||||
|
|
|
@ -196,16 +196,21 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))
|
|||
if (config == NULL)
|
||||
return 1;
|
||||
|
||||
notmuch = notmuch_database_open (notmuch_config_get_database_path (config));
|
||||
if (notmuch == NULL)
|
||||
return 1;
|
||||
|
||||
query_string = query_string_from_args (ctx, argc, argv);
|
||||
if (query_string == NULL) {
|
||||
fprintf (stderr, "Out of memory\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (*query_string == '\0') {
|
||||
fprintf (stderr, "Error: notmuch show requires at least one search term.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
notmuch = notmuch_database_open (notmuch_config_get_database_path (config));
|
||||
if (notmuch == NULL)
|
||||
return 1;
|
||||
|
||||
query = notmuch_query_create (notmuch, query_string);
|
||||
if (query == NULL) {
|
||||
fprintf (stderr, "Out of memory\n");
|
||||
|
|
|
@ -83,8 +83,10 @@ notmuch_tag_command (void *ctx, unused (int argc), unused (char *argv[]))
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (i == argc) {
|
||||
fprintf (stderr, "Error: 'notmuch tag' requires at least one search term.\n");
|
||||
query_string = query_string_from_args (ctx, argc - i, &argv[i]);
|
||||
|
||||
if (*query_string == '\0') {
|
||||
fprintf (stderr, "Error: notmuch tag requires at least one search term.\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -96,8 +98,6 @@ notmuch_tag_command (void *ctx, unused (int argc), unused (char *argv[]))
|
|||
if (notmuch == NULL)
|
||||
return 1;
|
||||
|
||||
query_string = query_string_from_args (ctx, argc - i, &argv[i]);
|
||||
|
||||
query = notmuch_query_create (notmuch, query_string);
|
||||
if (query == NULL) {
|
||||
fprintf (stderr, "Out of memory.\n");
|
||||
|
|
Loading…
Reference in a new issue