Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1E7A2431FDC for ; Thu, 13 Mar 2014 05:04:33 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bEjHckYPXuCf for ; Thu, 13 Mar 2014 05:04:28 -0700 (PDT) Received: from mail-we0-f172.google.com (mail-we0-f172.google.com [74.125.82.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id C7C39431FAF for ; Thu, 13 Mar 2014 05:04:22 -0700 (PDT) Received: by mail-we0-f172.google.com with SMTP id t61so762767wes.17 for ; Thu, 13 Mar 2014 05:04:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=ADbFGCJJaX4GLhrRxtgtlvEchHGyaa6zIbDgWviKddk=; b=lNu3KhcjHt6TTWnkKlyvp+cBRGrgEwllNvW9g1f05ZBhrxLf0bKnsUtADPc2UUwHHd rIomLlzv7C9L0iee91uoJJlA3ax7a4Ybwq7lSoa9l3NI0qw00d9DItN++nscGvCysbe2 owYTH0KfwYuKqAFR/1g1/7MUue4NU0l6yNoCSAIbeLtF5XMbbEqH8/qIcJozPJVW2tzb VQIIEt21qZlk++g4KhT80XZnRd+1hhGCxAWQnCMu+vudiSubqoDozZIVFdh+V0t9P3hW KH44JPZnUPW0ACc/YWoWm2PsMCdhs1RIj2ByFwIQR9Azwq3SbFehP8BDgQ9WOm/x9gLr KlQQ== X-Gm-Message-State: ALoCoQkvqe7Mg9LET+O5fgsMlgiMg+wiAkKZDj9oLocZIdaSKSAjLWSh+XB4IQ1UoKsVdeAzDfDk X-Received: by 10.180.24.134 with SMTP id u6mr1275596wif.41.1394712260952; Thu, 13 Mar 2014 05:04:20 -0700 (PDT) Received: from localhost ([2001:4b98:dc0:43:216:3eff:fe1b:25f3]) by mx.google.com with ESMTPSA id n15sm6942404wij.3.2014.03.13.05.04.18 for (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Thu, 13 Mar 2014 05:04:20 -0700 (PDT) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH 2/2] nmbug-status: make output title and blurb configurable Date: Thu, 13 Mar 2014 13:04:05 +0100 Message-Id: <22dad934512fcdb2d3e1ff652393225088f58f5d.1394711823.git.jani@nikula.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: References: In-Reply-To: References: X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Mar 2014 12:04:33 -0000 Make nmbug-status more generally usable outside of nmbug by not hardcoding notmuch related things. This lets anyone publish html search views to mailing list messages with a custom config file, independent of nmbug. --- devel/nmbug/nmbug-status | 32 +++++++++++++++----------------- devel/nmbug/status-config.json | 5 +++++ 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status index cb3901f..03621bd 100755 --- a/devel/nmbug/nmbug-status +++ b/devel/nmbug/nmbug-status @@ -242,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( @@ -292,29 +305,14 @@ Generated: {date}

Views

'''.format(date=datetime.datetime.utcnow().date(), - title='Notmuch Patches', - blurb='For more infomation see nmbug', + 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']) diff --git a/devel/nmbug/status-config.json b/devel/nmbug/status-config.json index 6b4934f..3f02c81 100644 --- a/devel/nmbug/status-config.json +++ b/devel/nmbug/status-config.json @@ -1,4 +1,9 @@ { + "meta": { + "title": "Notmuch Patches", + "blurb": "For more infomation see nmbug" + }, + "views": [ { "comment": "Unresolved bugs (or just need tag updating).", -- 1.7.2.5