X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch;h=6e41fa21bd26f23578d423acfa149fae5bcf04c8;hp=5862b9ac5ab991f8633e16869522ded5340abf97;hb=cd19699e0d32eccc6481c0a3294b38c4fe0042e8;hpb=23b32a7dfdeec9acc2ad800e1d307b31cf82052d diff --git a/notmuch b/notmuch index 5862b9ac..6e41fa21 100755 --- a/notmuch +++ b/notmuch @@ -1,6 +1,12 @@ #!/usr/bin/env python -"""This is a notmuch implementation in python. It's goal is to allow running the test suite on the cnotmuch python bindings.""" +"""This is a notmuch implementation in python. It's goal is to allow running the test suite on the cnotmuch python bindings. + +This "binary" honors the NOTMUCH_CONFIG environmen variable for reading a user's +notmuch configuration (e.g. the database path) + +This code is licensed under the GNU GPL v3+.""" import sys, os, re, logging +from subprocess import call from cnotmuch.notmuch import Database, Query PREFIX=re.compile('(\w+):(.*$)') #TODO Handle variable: NOTMUCH-CONFIG @@ -108,6 +114,11 @@ if __name__ == '__main__': """ Interactively setup notmuch for first use. """ print "Not implemented." #------------------------------------- + elif sys.argv[1] == 'new': + """ Interactively setup notmuch for first use. """ + #print "Not implemented. We cheat by calling the proper notmuch" + call(['notmuch new'],shell=True) + #------------------------------------- elif sys.argv[1] == 'help': if len(sys.argv) == 2: print HELPTEXT else: print "Not implemented" @@ -177,12 +188,16 @@ if __name__ == '__main__': #------------------------------------- elif sys.argv[1] == 'dump': #TODO: implement "dump " + if len(sys.argv) == 2: + f = sys.stdout + else: + f = open(sys.argv[2],"w") db = Database() q = Query(db,'') q.set_sort(Query.SORT.MESSAGE_ID) m = q.search_messages() for msg in m: - print("%s (%s)" % (msg.get_message_id(), msg.get_tags())) + f.write("%s (%s)\n" % (msg.get_message_id(), msg.get_tags())) #------------------------------------- else: # unknown command