X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=devel%2Fnmbug%2Fnmbug-status;h=03621bd534491b185db4dbbc63e4ad38b52b6d14;hb=dd24fdd33a3c06b2c2ad6bcb8e7d18bc8442f51f;hp=c4532f1873799e1693fd9d3c60b979f444019f7e;hpb=ffed8f2866a567d52eebeca02d3c362de07efc9d;p=notmuch diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status index c4532f18..03621bd5 100755 --- a/devel/nmbug/nmbug-status +++ b/devel/nmbug/nmbug-status @@ -13,7 +13,6 @@ import codecs import collections import datetime import email.utils -import locale try: # Python 3 from urllib.parse import quote except ImportError: # Python 2 @@ -27,7 +26,7 @@ import subprocess import xml.sax.saxutils -_ENCODING = locale.getpreferredencoding() or sys.getdefaultencoding() +_ENCODING = 'UTF-8' _PAGES = {} @@ -42,7 +41,7 @@ if not hasattr(collections, 'OrderedDict'): # Python 2.6 or earlier super(_OrderedDict, self).__setitem__(key, value) self._keys.append(key) - def __values__(self): + def values(self): for key in self._keys: yield self[key] @@ -243,6 +242,19 @@ class HtmlPage (Page): def _slug(self, string): return self._slug_regexp.sub('-', string) +parser = argparse.ArgumentParser() +parser.add_argument('--text', help='output plain text format', + action='store_true') +parser.add_argument('--config', help='load config from given file', + metavar='PATH') +parser.add_argument('--list-views', help='list views', + action='store_true') +parser.add_argument('--get-query', help='get query for view', + metavar='VIEW') + +args = parser.parse_args() + +config = read_config(path=args.config) _PAGES['text'] = Page() _PAGES['html'] = HtmlPage( @@ -250,7 +262,7 @@ _PAGES['html'] = HtmlPage( - Notmuch Patches + {title} -

Notmuch Patches

+

{title}

Generated: {date}
-For more infomation see nmbug +{blurb}

Views

'''.format(date=datetime.datetime.utcnow().date(), + title=config['meta']['title'], + blurb=config['meta']['blurb'], encoding=_ENCODING, inter_message_padding='0.25em', border_radius='0.5em'), footer='\n\n', ) - -parser = argparse.ArgumentParser() -parser.add_argument('--text', help='output plain text format', - action='store_true') -parser.add_argument('--config', help='load config from given file', - metavar='PATH') -parser.add_argument('--list-views', help='list views', - action='store_true') -parser.add_argument('--get-query', help='get query for view', - metavar='VIEW') - -args = parser.parse_args() - -config = read_config(path=args.config) - if args.list_views: for view in config['views']: print(view['title'])