X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=notmuch-to-html;fp=notmuch-to-html;h=41c7a751bf8ae1b0852ace918ae361d0bb3cfd87;hb=7d7ce236dbae8ec161839305f13a49ddd615e611;hp=f0146f8ea0c6137d15458609603be10635805fba;hpb=9b8c173e680704b041a7db5a2f8944a1ae21a9a1;p=obsolete%2Fnotmuch-to-html diff --git a/notmuch-to-html b/notmuch-to-html index f0146f8..41c7a75 100755 --- a/notmuch-to-html +++ b/notmuch-to-html @@ -62,27 +62,11 @@ if not hasattr(collections, 'OrderedDict'): # Python 2.6 or earlier collections.OrderedDict = _OrderedDict -def read_config(path=None, encoding=None): +def read_config(path, encoding=None): "Read config from json file" if not encoding: encoding = _ENCODING - if path: - fp = open(path) - else: - nmbhome = os.getenv('NMBGIT', os.path.expanduser('~/.nmbug')) - - # read only the first line from the pipe - sha1_bytes = subprocess.Popen( - ['git', '--git-dir', nmbhome, 'show-ref', '-s', 'config'], - stdout=subprocess.PIPE).stdout.readline() - sha1 = sha1_bytes.decode(encoding).rstrip() - - fp_byte_stream = subprocess.Popen( - ['git', '--git-dir', nmbhome, 'cat-file', 'blob', - sha1+':status-config.json'], - stdout=subprocess.PIPE).stdout - fp = codecs.getreader(encoding=encoding)(stream=fp_byte_stream) - + fp = open(path) return json.load(fp) @@ -253,10 +237,9 @@ 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') -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',