fprintf (stderr, "Option \"%s\" needs a string argument.\n", arg_desc->name);
return false;
}
- if (arg_str[0] == '\0') {
+ if (arg_str[0] == '\0' && ! arg_desc->allow_empty) {
fprintf (stderr, "String argument for option \"%s\" must be non-empty.\n", arg_desc->name);
return false;
}
/* Optional, if non-NULL, set to true if the option is present. */
bool *present;
+ /* Optional, allow empty strings for opt_string. */
+ bool allow_empty;
+
/* Must be set for opt_keyword and opt_flags. */
const struct notmuch_keyword *keywords;
} notmuch_opt_desc_t;
``--folder=<``\ folder\ **>**
Deliver the message to the specified folder, relative to the
top-level directory given by the value of **database.path**. The
- default is to deliver to the top-level directory.
+ default is the empty string, which means delivering to the
+ top-level directory.
``--create-folder``
Try to create the folder named by the ``--folder`` option, if it
unsigned int i;
notmuch_opt_desc_t options[] = {
- { .opt_string = &folder, .name = "folder" },
+ { .opt_string = &folder, .name = "folder", .allow_empty = true },
{ .opt_bool = &create_folder, .name = "create-folder" },
{ .opt_bool = &keep, .name = "keep" },
{ .opt_bool = &no_hooks, .name = "no-hooks" },