recollindex: allow passing -e -i for erasing index data before rebuilding

This commit is contained in:
Jean-Francois Dockes 2014-05-01 08:04:44 +02:00
parent 7c9b13d64e
commit ed7a970ee6

View File

@ -448,11 +448,17 @@ int main(int argc, char **argv)
filenames.push_back(*argv++);
}
}
bool status;
if (op_flags & OPT_i)
status = indexfiles(config, filenames);
else
// Note that -e and -i may be both set. In this case we first erase,
// then index. This is a slightly different from -Z -i because we
// warranty that all subdocs are purged.
bool status = true;
if (op_flags & OPT_e) {
status = purgefiles(config, filenames);
}
if (status && (op_flags & OPT_i)) {
status = indexfiles(config, filenames);
}
if (confindexer && !confindexer->getReason().empty())
cerr << confindexer->getReason() << endl;
exit(status ? 0 : 1);