From: Jani Nikula <jani@nikula.org>
To: notmuch@notmuchmail.org
Cc: Tomi Ollila <tomi.ollila@iki.fi>
Subject: [PATCH 2/3] nmbug-status: add support for querying the search views
Date: Mon, 1 Apr 2013 12:44:01 +0300 [thread overview]
Message-ID: <9bb1be6703c10474d96ccb0f07292e55659a2436.1364809172.git.jani@nikula.org> (raw)
In-Reply-To: <cover.1364809172.git.jani@nikula.org>
In-Reply-To: <cover.1364809172.git.jani@nikula.org>
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
next prev parent reply other threads:[~2013-04-01 9:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-01 9:43 [PATCH 0/3] nmbug-status: add support for querying the search views Jani Nikula
2013-04-01 9:44 ` [PATCH 1/3] nmbug-status: simplify config file read from nmbug git Jani Nikula
2013-04-01 11:50 ` David Bremner
2013-04-01 12:11 ` Jani Nikula
2013-04-01 9:44 ` Jani Nikula [this message]
2013-04-01 9:44 ` [PATCH 3/3] nmbug-status: only import notmuch when needed Jani Nikula
2013-04-06 11:39 ` David Bremner
2013-04-01 9:56 ` [PATCH 0/3] nmbug-status: add support for querying the search views Tomi Ollila
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9bb1be6703c10474d96ccb0f07292e55659a2436.1364809172.git.jani@nikula.org \
--to=jani@nikula.org \
--cc=notmuch@notmuchmail.org \
--cc=tomi.ollila@iki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).