2 """This is a notmuch implementation in python. It's goal is to allow running the test suite on the cnotmuch python bindings."""
4 from cnotmuch.notmuch import Database, Query
5 #TODO Handle variable: NOTMUCH-CONFIG
7 #-------------------------------------------------------------------------
8 HELPTEXT="""The notmuch mail system.
10 Usage: notmuch <command> [args...]
12 Where <command> and [args...] are as follows:
14 setup Interactively setup notmuch for first use.
18 Find and import new messages to the notmuch database.
20 search [options...] <search-terms> [...]
22 Search for messages matching the given search terms.
24 show <search-terms> [...]
26 Show all messages matching the search terms.
28 count <search-terms> [...]
30 Count messages matching the search terms.
32 reply [options...] <search-terms> [...]
34 Construct a reply template for a set of messages.
36 tag +<tag>|-<tag> [...] [--] <search-terms> [...]
38 Add/remove tags for all messages matching the search terms.
42 Create a plain-text dump of the tags for each message.
46 Restore the tags from the given dump file (see 'dump').
48 search-tags [<search-terms> [...] ]
50 List all tags found in the database or matching messages.
54 This message, or more detailed help for the named command.
56 Use "notmuch help <command>" for more details on each command.
57 And "notmuch help search-terms" for the common search-terms syntax.
59 #-------------------------------------------------------------------------
60 #TODO: replace the dynamic pieces
61 USAGE="""Notmuch is configured and appears to have a database. Excellent!
63 At this point you can start exploring the functionality of notmuch by
64 using commands such as:
66 notmuch search tag:inbox
68 notmuch search to:"Sebastian Spaeth"
70 notmuch search from:"Sebastian@SSpaeth.de"
72 notmuch search subject:"my favorite things"
74 See "notmuch help search" for more details.
76 You can also use "notmuch show" with any of the thread IDs resulting
77 from a search. Finally, you may want to explore using a more sophisticated
78 interface to notmuch such as the emacs interface implemented in notmuch.el
79 or any other interface described at http://notmuchmail.org
81 And don't forget to run "notmuch new" whenever new mail arrives.
83 Have fun, and may your inbox never have much mail.
85 #-------------------------------------------------------------------------
86 if __name__ == '__main__':
88 # Handle command line options
90 if len(sys.argv) == 1:
93 elif sys.argv[1] == 'setup':
94 """ Interactively setup notmuch for first use. """
95 print "Not implemented."
97 elif sys.argv[1] == 'help':
98 if len(sys.argv) == 2: print HELPTEXT
99 else: print "Not implemented"
101 elif sys.argv[1] == 'new':
102 #TODO: handle --verbose
103 print "Not implemented."
105 elif sys.argv[1] == 'search-tags':
106 if len(sys.argv) == 2:
107 print("\n".join(Database().get_all_tags()))
109 else: print "Not implemented"
113 print "Error: Unknown command '%s' (see \"notmuch help\")" % sys.argv[1]
118 search [options...] <search-terms> [...]
120 Search for messages matching the given search terms.
122 show <search-terms> [...]
124 Show all messages matching the search terms.
126 count <search-terms> [...]
128 Count messages matching the search terms.
130 reply [options...] <search-terms> [...]
132 Construct a reply template for a set of messages.
134 tag +<tag>|-<tag> [...] [--] <search-terms> [...]
136 Add/remove tags for all messages matching the search terms.
140 Create a plain-text dump of the tags for each message.
143 search-tags [<search-terms> [...] ]
145 List all tags found in the database or matching messages.