X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=notmuch-to-html;h=712fbb7ee2e85637fd4d6eed2c52817554d6d5c2;hb=refs%2Fheads%2Fmaster;hp=41c7a751bf8ae1b0852ace918ae361d0bb3cfd87;hpb=7d7ce236dbae8ec161839305f13a49ddd615e611;p=obsolete%2Fnotmuch-to-html
diff --git a/notmuch-to-html b/notmuch-to-html
index 41c7a75..712fbb7 100755
--- a/notmuch-to-html
+++ b/notmuch-to-html
@@ -1,6 +1,10 @@
#!/usr/bin/python
#
+# Generate an HTML page with the result of one or more notmuch
+# searches, (with links to gmane views of each email if available).
+#
# Copyright (c) 2011-2012 David Bremner
+# Copyright (c) 2014 Carl Worth This view is generated from the following query:',
'
',
'',
' ',
- view['query-string'],
+ 'notmuch search ' + view['query-string'],
'
',
'
',
]:
@@ -237,9 +257,13 @@ class HtmlPage (Page):
return self._slug_regexp.sub('-', string)
parser = argparse.ArgumentParser()
-parser.add_argument('config', help='path to configuration file', metavar='CONFIG_FILE')
parser.add_argument('--text', help='output plain text format',
action='store_true')
+group = parser.add_mutually_exclusive_group()
+group.add_argument('--config', help='path to configuration file',
+ metavar='PATH')
+group.add_argument('--query', help='path to configuration file',
+ metavar='PATH')
parser.add_argument('--list-views', help='list views',
action='store_true')
parser.add_argument('--get-query', help='get query for view',
@@ -247,7 +271,17 @@ parser.add_argument('--get-query', help='get query for view',
args = parser.parse_args()
-config = read_config(path=args.config)
+if (args.config):
+ config = read_config(path=args.config)
+elif (args.query):
+ config = json.loads(DEFAULT_CONFIG.format(query=args.query))
+else:
+ print ('''To use notmuch-to-html, you need to provide a notmuch query. Try:
+
+ notmuch-to-html --query=tag:inbox
+
+Or 'notmuch-to-html --help' for additional options.''')
+ exit (0)
_PAGES['text'] = Page()
_PAGES['html'] = HtmlPage(
@@ -292,18 +326,19 @@ _PAGES['html'] = HtmlPage(
{title}
-
-Generated: {date}
{blurb}
Views
-'''.format(date=datetime.datetime.utcnow().date(),
- title=config['meta']['title'],
+'''.format(title=config['meta']['title'],
blurb=config['meta']['blurb'],
encoding=_ENCODING,
inter_message_padding='0.25em',
border_radius='0.5em'),
- footer='\n