mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 18:38:08 +01:00
tag-util: move out 'tag' command-line check
Move an error condition specific to the 'tag' command out of parse_tag_command_line so that parse_tag_command_line can be used for the forthcoming 'insert' command.
This commit is contained in:
parent
b7df509fb5
commit
e8efa11da9
2 changed files with 8 additions and 3 deletions
|
@ -247,6 +247,11 @@ notmuch_tag_command (notmuch_config_t *config, int argc, char *argv[])
|
||||||
fprintf (stderr, "Error: 'notmuch tag' requires at least one tag to add or remove.\n");
|
fprintf (stderr, "Error: 'notmuch tag' requires at least one tag to add or remove.\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (*query_string == '\0') {
|
||||||
|
fprintf (stderr, "Error: notmuch tag requires at least one search term.\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notmuch_database_open (notmuch_config_get_database_path (config),
|
if (notmuch_database_open (notmuch_config_get_database_path (config),
|
||||||
|
|
|
@ -190,9 +190,9 @@ parse_tag_command_line (void *ctx, int argc, char **argv,
|
||||||
|
|
||||||
*query_str = query_string_from_args (ctx, argc - i, &argv[i]);
|
*query_str = query_string_from_args (ctx, argc - i, &argv[i]);
|
||||||
|
|
||||||
if (*query_str == NULL || **query_str == '\0') {
|
if (*query_str == NULL) {
|
||||||
fprintf (stderr, "Error: notmuch tag requires at least one search term.\n");
|
fprintf (stderr, "Out of memory.\n");
|
||||||
return TAG_PARSE_INVALID;
|
return TAG_PARSE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TAG_PARSE_SUCCESS;
|
return TAG_PARSE_SUCCESS;
|
||||||
|
|
Loading…
Reference in a new issue