Add an option to filter by object hash
Implement a new --filter-hash option to filter by object identifiers. Each object having an identifier that has the specified pattern as a prefix is matched. Patterns starting with an exclamation mark (!) are interpreted as negative patterns. Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
This commit is contained in:
16
src/io.c
16
src/io.c
@@ -684,8 +684,20 @@ void io_load_todo(struct item_filter *filter)
|
||||
continue;
|
||||
}
|
||||
|
||||
todo_add(e_todo, id, note);
|
||||
++nb_tod;
|
||||
struct todo *todo = todo_add(e_todo, id, note);
|
||||
|
||||
/* Filter by hash. */
|
||||
if (filter && filter->hash) {
|
||||
char *hash = todo_hash(todo);
|
||||
if (!hash_matches(filter->hash, hash)) {
|
||||
todo_delete(todo);
|
||||
todo = NULL;
|
||||
}
|
||||
mem_free(hash);
|
||||
}
|
||||
|
||||
if (todo)
|
||||
++nb_tod;
|
||||
}
|
||||
file_close(data_file, __FILE_POS__);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user