mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-12-22 17:34:54 +01:00
cli: make caller check tag count in parse_tag_command_line
This commit is contained in:
parent
703136c57b
commit
a6822eccac
2 changed files with 5 additions and 5 deletions
|
@ -233,6 +233,11 @@ notmuch_tag_command (notmuch_config_t *config, int argc, char *argv[])
|
||||||
if (parse_tag_command_line (config, argc - opt_index, argv + opt_index,
|
if (parse_tag_command_line (config, argc - opt_index, argv + opt_index,
|
||||||
&query_string, tag_ops))
|
&query_string, tag_ops))
|
||||||
return 1;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notmuch_database_open (notmuch_config_get_database_path (config),
|
if (notmuch_database_open (notmuch_config_get_database_path (config),
|
||||||
|
|
|
@ -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);
|
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]);
|
*query_str = query_string_from_args (ctx, argc - i, &argv[i]);
|
||||||
|
|
||||||
if (*query_str == NULL || **query_str == '\0') {
|
if (*query_str == NULL || **query_str == '\0') {
|
||||||
|
|
Loading…
Reference in a new issue