mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-23 03:18:08 +01:00
implement notmuch dump and Messages.len()
--HG-- extra : transplant_source : %03_%C7%99L%16%7E%A8%B1p%11%11%A0%E3h%A3%AB%B6%FB%86
This commit is contained in:
parent
3b2d73c684
commit
4081ed75b5
2 changed files with 16 additions and 5 deletions
|
@ -253,6 +253,13 @@ class Tags(object):
|
||||||
nmlib.notmuch_tags_move_to_next(self._tags)
|
nmlib.notmuch_tags_move_to_next(self._tags)
|
||||||
return tag
|
return tag
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
"""str() of Tags() is a space separated list of tags
|
||||||
|
|
||||||
|
This iterates over the list of Tags and will therefore 'exhaust' Tags()
|
||||||
|
"""
|
||||||
|
return " ".join(self)
|
||||||
|
|
||||||
def __del__(self):
|
def __del__(self):
|
||||||
"""Close and free the notmuch tags"""
|
"""Close and free the notmuch tags"""
|
||||||
if self._tags is not None:
|
if self._tags is not None:
|
||||||
|
|
14
notmuch
14
notmuch
|
@ -135,9 +135,17 @@ if __name__ == '__main__':
|
||||||
querystr = quote_query_line(sys.argv[2:])
|
querystr = quote_query_line(sys.argv[2:])
|
||||||
logging.debug("search-term "+querystr)
|
logging.debug("search-term "+querystr)
|
||||||
db = Database()
|
db = Database()
|
||||||
m = Query(db,querystr).search_messages()
|
q = Query(db,querystr)
|
||||||
|
#TODO: notmuch_query_set_sort (query, NOTMUCH_SORT_MESSAGE_ID);
|
||||||
|
m = q.search_messages()
|
||||||
print("\n".join([t for t in m.collect_tags()]))
|
print("\n".join([t for t in m.collect_tags()]))
|
||||||
|
|
||||||
|
elif sys.argv[1] == 'dump':
|
||||||
|
db = Database()
|
||||||
|
msgs = Query(db,'').search_messages()
|
||||||
|
for msg in msgs:
|
||||||
|
print("%s (%s)" % (msg.get_message_id(), msg.get_tags()))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# unknown command
|
# unknown command
|
||||||
print "Error: Unknown command '%s' (see \"notmuch help\")" % sys.argv[1]
|
print "Error: Unknown command '%s' (see \"notmuch help\")" % sys.argv[1]
|
||||||
|
@ -153,10 +161,6 @@ show <search-terms> [...]
|
||||||
|
|
||||||
Show all messages matching the search terms.
|
Show all messages matching the search terms.
|
||||||
|
|
||||||
count <search-terms> [...]
|
|
||||||
|
|
||||||
Count messages matching the search terms.
|
|
||||||
|
|
||||||
reply [options...] <search-terms> [...]
|
reply [options...] <search-terms> [...]
|
||||||
|
|
||||||
Construct a reply template for a set of messages.
|
Construct a reply template for a set of messages.
|
||||||
|
|
Loading…
Reference in a new issue