From: Jani Nikula Date: Mon, 1 Apr 2013 09:44:01 +0000 (+0300) Subject: [PATCH 2/3] nmbug-status: add support for querying the search views X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e8fb2c2188e47e2c18df75e98cf5cfdaf437c261;p=notmuch-archives.git [PATCH 2/3] nmbug-status: add support for querying the search views --- diff --git a/79/1af033fd61a85df9cd70f1cc189d50bdfbec00 b/79/1af033fd61a85df9cd70f1cc189d50bdfbec00 new file mode 100644 index 000000000..921d043e1 --- /dev/null +++ b/79/1af033fd61a85df9cd70f1cc189d50bdfbec00 @@ -0,0 +1,120 @@ +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 E91AF429E51 + for ; Mon, 1 Apr 2013 02:44:16 -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 Zb95TUGWDf16 for ; + Mon, 1 Apr 2013 02:44:16 -0700 (PDT) +Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com + [209.85.217.169]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id BD989429E53 + for ; Mon, 1 Apr 2013 02:44:12 -0700 (PDT) +Received: by mail-lb0-f169.google.com with SMTP id p11so1782989lbi.28 + for ; Mon, 01 Apr 2013 02:44:11 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=google.com; s=20120113; + h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to + :references:in-reply-to:references:x-gm-message-state; + bh=tCTkPbzXJfpliooaNzv9wxgSS4RuWr2VkhCzkeR72/U=; + b=NMiA8r2s/c6qlhrAIFy+d0CNU1qFle8nlyztK3nDzgg6ST0U1WOpgfW0kBNhPhYm+t + tW0FiigvPFoclrCHEDINBjiBJyt2+HkZNq3wDKYu7NSDNZ+jhdY1DKb4ygM9Uuni5S8J + DplVO5JfKB98T+Vu51jmagR2maQlYJ4/1ISR9695r0jT8BxQ6Otp52DNgiti/E/tEibG + Yi33SsqZvpgPBhbNwv9vOPWsSp8du/Urxo8yhQEQYfw8rI7C8Ku9Z7Sk1jltwhny86ui + 8VKPnFg/ZmUHXawrKCUh4p0BimmZ/h21IFBIUdNKPznXnwyibSPlIHtd7/qbIq9Bg6zW + XwUg== +X-Received: by 10.152.104.199 with SMTP id gg7mr5357501lab.14.1364809451289; + Mon, 01 Apr 2013 02:44:11 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw4-50df51-27.dhcp.inet.fi. + [80.223.81.27]) + by mx.google.com with ESMTPS id e9sm5204773lbz.1.2013.04.01.02.44.09 + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Mon, 01 Apr 2013 02:44:10 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH 2/3] nmbug-status: add support for querying the search views +Date: Mon, 1 Apr 2013 12:44:01 +0300 +Message-Id: + <9bb1be6703c10474d96ccb0f07292e55659a2436.1364809172.git.jani@nikula.org> +X-Mailer: git-send-email 1.7.10.4 +In-Reply-To: +References: +In-Reply-To: +References: +X-Gm-Message-State: + ALoCoQlE6f5QJIbZG/ZdaWIVM9OwUsxgHMIEMG6jfjNcec5RdQwY9q7VEgp7gubjb/5WAPafWDk6 +Cc: Tomi Ollila +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: Mon, 01 Apr 2013 09:44:17 -0000 + +Make it easy for scripts to read the views and corresponding searches. +--- + devel/nmbug/nmbug-status | 16 ++++++++++++++-- + 1 file changed, 14 insertions(+), 2 deletions(-) + +diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status +index 0283013..d83ca2d 100755 +--- a/devel/nmbug/nmbug-status ++++ b/devel/nmbug/nmbug-status +@@ -13,6 +13,7 @@ import urllib + import json + import argparse + import os ++import sys + import subprocess + + # parse command line arguments +@@ -20,9 +21,10 @@ import subprocess + 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') +- ++parser.add_argument('--list-views', help='list views', ++ action='store_true') ++parser.add_argument('--get-query', help='get query for view') + + args = parser.parse_args() + +@@ -38,6 +40,16 @@ else: + + config = json.load(fp) + ++if args.list_views: ++ for view in config['views']: ++ print view['title'] ++ sys.exit(0) ++elif args.get_query != None: ++ for view in config['views']: ++ if args.get_query == view['title']: ++ print ' and '.join(view['query']) ++ sys.exit(0) ++ + if args.text: + output_format = 'text' + else: +-- +1.7.10.4 +